|
楼主 |
发表于 2018-7-9 09:55:34
|
显示全部楼层
server {
listen 8881;
listen [::]:8881;
server_name localhost:8881;
root /srv/www/develop/ChineseFood;
index index.php index.html index.htm;
location / {
# 这里使用try_files进行url重写,不用rewrite了。
try_files $uri $uri/ /index.php?$uri&$args;
#root /srv/www/develop/ChineseFood;
index index.php;
#if (!-e $request_filename) {
# rewrite ^/(.*)$ /index.php/$1 last;
# break;
#}
}
location ~ \.php($|/) {
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index /index.php;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php/$1 last;
break;
}
}
这是服务器Nginx的配置,我根据网上,换了好几个版本,结果都是同样的结果 |
|