Home  >  Q&A  >  body text

php - laravel cannot run after configuring 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=/;    
    } 
    

    }

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/"

天蓬老师天蓬老师2724 days ago747

reply all(2)I'll reply

  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-05-27 17:45:48

    The prompt is that a loopback address has been formed

    Remove the second location and take a look

    reply
    0
  • 某草草

    某草草2017-05-27 17:45:48

    Replace the first try_files with this:

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

    Try deleting the second one

    reply
    0
  • Cancelreply