您的位置:首页 > 运维架构 > Nginx

NGINX关于配置PATHINFO

2015-06-08 10:41 477 查看
最近在群里发现有很多小白不会配置pathinfo现贴出来配置代码照着配置就可以了

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

server
{
listen 80;
server_name xxx.com
root /alidata1/wwwroot/xxx;
index index.html index.htm index.php;
//这里是关键
location ~ \.php {
fastcgi_pass 127.0.0.1:9000;
#fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include /usr/local/nginx/conf/fastcgi_params;
set $real_script_name $fastcgi_script_name;
if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {
set $real_script_name $1;
set $path_info $2;
}
fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
fastcgi_param SCRIPT_NAME $real_script_name;
fastcgi_param PATH_INFO $path_info;
}
access_log /home/wwwlogs/access.log access;
}

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: