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

Nginx服务器支持pathinfo模式

2017-03-01 11:30 267 查看
项目往往需要被支持pathinfo方式访问,给出nginx下相关配置

,找到配置文件nginx.conf,在server { }中添加一段以下代码,重启nginx即可

location ~ \.php {
root           html/code;
fastcgi_pass   127.0.0.1:9000;
fastcgi_index  index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
include        fastcgi_params;
}


重启nginx命令如下

service nginx restart
或者使用
/usr/nginx/sbin/nginx -s reload
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: