V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
unboy
V2EX  ›  PHP

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

  •  
  •   unboy · 2018-04-20 11:41:04 +08:00 · 3848 次点击
    这是一个创建于 2191 天前的主题,其中的信息可能已经有所发展或是发生改变。
    错误代码: 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;
    #}
    }



    请问怎么修改,谢谢!
    8 条回复    2018-04-30 23:14:33 +08:00
    akira
        1
    akira  
       2018-04-20 12:29:40 +08:00   ❤️ 1
    看不出问题 上网址吧
    Showfom
        2
    Showfom  
       2018-04-20 12:52:08 +08:00 via iPhone   ❤️ 1
    root 多余
    fastcgi_params 自己写的吗 贴上来看看

    另外你 php 是监听的端口方式运行的吗
    chuhemiao
        3
    chuhemiao  
       2018-04-20 12:57:25 +08:00   ❤️ 1
    谷歌浏览器 dns 缓存清一下试试
    abowloflrf
        4
    abowloflrf  
       2018-04-20 13:01:35 +08:00 via iPhone   ❤️ 1
    提示重定向过多不一定是 nginx 的问题,如果找不到,建议看看 php 代码
    xfspace
        5
    xfspace  
       2018-04-20 13:41:31 +08:00   ❤️ 1
    fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
    >>
    fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html/abc$fastcgi_script_name;
    unboy
        6
    unboy  
    OP
       2018-04-21 20:45:05 +08:00
    @xfspace 非常感谢,按照您的方法解决了。再次感谢!!
    sun999
        7
    sun999  
       2018-04-30 23:13:16 +08:00
    $document_root$fastcgi_script_name;
    sun999
        8
    sun999  
       2018-04-30 23:14:33 +08:00
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2735 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 12:59 · PVG 20:59 · LAX 05:59 · JFK 08:59
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.