引用路由时,nGinx会引发内部服务器错误

时间:2017-02-08 12:19:22

标签: nginx centos symfony php-7

刚刚在CentOS 7上安装了LEMP堆栈,其中包括PHP 7 .. 我上传了Symfony 3项目,我的问题是,当我尝试访问路由时,它只显示内部服务器错误,例如:当我被fos_user_bundle重定向到/ login时,存在内部服务器错误。 我查看了错误日志,它们看起来像这样: 2017/02/08 11:51:35 [错误] 488#0:* 1重写或内部重定向循环,同时内部重定向到“/index.html”,客户端:< ip address&gt ;, server:mydomain.ge,request :“GET /foldername/web/app_dev.php/login HTTP / 1.1”,主持人:“mydomain.ge” 服务器{     听80;     root / var / www / html;     index index.php index.html index.htm;     server_name mydomain.ge< server ip address&gt ;;     地点 / {         try_files $ uri $ uri / /index.html;     }     error_page 404 /404.html;     error_page 500 502 503 504 /50x.html;     location = /50x.html {         root / usr / share / nginx / www;     }     location~.php $ {         try_files $ uri = 404;         fastcgi_pass 127.0.0.1:9000;         fastcgi_index index.php;         fastcgi_param SCRIPT_FILENAME $ document_root $ fastcgi_script_name;         包括fastcgi_params;     } } 我的配置文件(example.conf)如上所示。 有任何想法吗?

1 个答案:

答案 0 :(得分:0)

如果您希望/login处理index.php,则需要将index.php添加到试用文件中。

try_files $uri $uri/ /index.php;