laravel 配置 nginx后无法运行

  1. ngixn配置

    server {

    listen       9000;
    server_name  localhost ;
    root   "/Applications/MAMP/htdocs/xx/xx/xx/public";
    location / {
        try_files \$uri \$uri/ /index.php?\$query_string;
        index  index.html index.htm index.php;
        #autoindex  on;
    }
    location @rewrite {    
        rewrite ^/(.*)$ /index.php?_url=/$1;    
    } 
    

    }

2.报错如下:
rewrite or internal redirection cycle while internally redirecting to "/index.php",
client: 127.0.0.1, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "localhost:9000", referrer: "http://localhost:9000/"

阅读 4.3k
2 个回答

提示是形成了回环地址

你把第二个location去掉看一下

你把第一个的 try_files 换成这样:

try_files $uri $uri/ /index.php?$query_string;

把第二个删除试试看

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题