Laravel5.5在nginx访问自定义路由返回404错误

Laravel5.5在nginx访问自定义路由返回404错误:

nginx解决办法:

在location /里面加上 try_files $uri $uri/ /index.php?$query_string;

如果配置文件中存在 try_files $uri $uri/ =404;需要将它注释掉或者删掉,否则会报错

    location /{
        root /root/laravel_test/public;
        index index.html index.htm index.php;
        try_files $uri $uri/ /index.php?$query_string; 
    }

重启nginx:

systemctl restart nginx

访问:http://192.168.1.172/welcome

猜你喜欢

转载自my.oschina.net/michaelshu/blog/1826256