分享一个 Nginx 配置实例,以支持 PHP 中读取 PATH_INFO,修改后重新加载 Nginx 即可生效
server {
listen 80;
server_name api.uozi.org;
root /Users/Jacky/www/JianJi-PHP;
access_log logs/host.access.log main;
index index.html index.htm index.php;
include /Users/Jacky/www/JianJi-PHP/api_nginx.conf;
location ~ \.php {
include /usr/local/etc/nginx/fastcgi.conf;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param REDIRECT_STATUS 200;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_split_path_info ^(.+\.php)(.*)$; #增加这一句
fastcgi_param PATH_INFO $fastcgi_path_info; #增加这一句
}
}
文章最后修订于 2017年9月9日
评论 (0)