码迷,mamicode.com
首页 > Web开发 > 详细

THINKPHP框架NGINX重写配置

时间:2015-06-23 23:06:13      阅读:188      评论:0      收藏:0      [点我收藏+]

标签:

server {
listen 80;
server_name 域名;
root APP地址;
index index.php;
error_page 400 /errpage/400.html;
error_page 403 /errpage/403.html;
error_page 404 /errpage/404.html;
error_page 405 /errpage/405.html;

location / {
index index.htm index.html index.php;
#如果文件不存在则尝试TP解析
try_files $uri /index.php$uri;
}
location ~ .+\.php($|/) {
root APP地址;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;

#设置PATH_INFO,注意fastcgi_split_path_info已经自动改写了fastcgi_script_name变量,
#后面不需要再改写SCRIPT_FILENAME,SCRIPT_NAME环境变量,所以必须在加载fastcgi.conf之前设置
fastcgi_split_path_info ^(.+\.php)(/.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;

#加载Nginx默认"服务器环境变量"配置
include fastcgi.conf;
}
}

 

THINKPHP框架NGINX重写配置

标签:

原文地址:http://www.cnblogs.com/coolvo/p/4596293.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!