关于thinkphp框架的nginx配置

server {
listen 80;
server_name school.quxueabc.com;
root /www;
index index.html index.htm index.php;
access_log /www/log/error.log;

location / {
index index.htm index.html index.php;
#访问路径的文件不存在则重写URL转交给ThinkPHP处理
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php/$1 last;
break;
}
}
location ~ \.php/?.*$ {
root /www;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
#加载Nginx默认”服务器环境变量”配置
include fastcgi_params;

#设置PATH_INFO并改写SCRIPT_FILENAME,SCRIPT_NAME服务器环境变量
set $fastcgi_script_name2 $fastcgi_script_name;
if ($fastcgi_script_name ~ “^(.+\.php)(/.+)$”) {
set $fastcgi_script_name2 $1;
set $path_info $2;
}
fastcgi_param PATH_INFO $path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name2;
fastcgi_param SCRIPT_NAME $fastcgi_script_name2;
}
}

http://www.thinkphp.cn/code/937.html

http://jichangxucode.blog.163.com/blog/static/2077133912014112232955795/

原文链接:https://www.hertzdance.com/blog/thinkphp-nginx,转载请注明出处。

0

评论0

请先
欢迎光临频率跳动资源网
显示验证码
没有账号?注册  忘记密码?