请帮忙看一下 nginx 里 PHP 配置不对,网页提示重定向过多。

2018-04-20 11:41:04 +08:00
 unboy
错误代码: INET_E_REDIRECT_FAILED

server {
listen 80;
#server_name localhost;
server_name abc.com;
root /usr/share/nginx/html/abc;
#charset koi8-r;

#access_log logs/host.access.log main;

location / {
index index.php index.html index.htm;
}

error_page 400 401 402 403 404 405 500 502 503 504 505 /404.php;
# redirect server error pages to the static page /50x.html
#
#error_page 500 502 503 504 /50x.html;
#location = /50x.html {
# root html;
#}

# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root /usr/share/nginx/html/abc;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi_params;
}

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}



请问怎么修改,谢谢!
3861 次点击
所在节点    PHP
8 条回复
akira
2018-04-20 12:29:40 +08:00
看不出问题 上网址吧
Showfom
2018-04-20 12:52:08 +08:00
root 多余
fastcgi_params 自己写的吗 贴上来看看

另外你 php 是监听的端口方式运行的吗
chuhemiao
2018-04-20 12:57:25 +08:00
谷歌浏览器 dns 缓存清一下试试
abowloflrf
2018-04-20 13:01:35 +08:00
提示重定向过多不一定是 nginx 的问题,如果找不到,建议看看 php 代码
xfspace
2018-04-20 13:41:31 +08:00
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
>>
fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html/abc$fastcgi_script_name;
unboy
2018-04-21 20:45:05 +08:00
@xfspace 非常感谢,按照您的方法解决了。再次感谢!!
sun999
2018-04-30 23:13:16 +08:00
$document_root$fastcgi_script_name;
sun999
2018-04-30 23:14:33 +08:00
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/448402

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX