tp5部署到nginx后所有分页404的解决办法

时间:2023-01-06 07:57:11


# Begin HTTP Server
server {
listen 80;
server_name api.yunliu.co www.yunliu.co yunliu.co;
access_log logs/localhost_access.log;
error_log logs/localhost_error.log;
root E:/cloudflow/think/public;
index index.php index.html index.htm;
location / {
### 下边这一句很关键 ###
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=/$1 last;
}
##########################
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass php_processes;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
}
# End HTTP Server

参考:

​http://www.thinkphp.cn/topic/65411.html​