我的知识记录分享
location / {
index index.html index.htm;
#autoindex on;
# 添加下面代码 开启nginx的重写模块
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=/$1 last;
break;
}
# 添加代码截止
}
location ~ \.php(.*)$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
#添加下面两句 fastcgi权限,可以支持 ?s=/module/controller/action的url访问模式
fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
#添加下面两句 支持 index.php/index/index/index的pathinfo模式
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
# 添加代码截止
include fastcgi_params;
}
发表评论: