Laravel routes not found after nginx install

前端 未结 6 791
失恋的感觉
失恋的感觉 2020-12-24 02:17

After I changed ICG to nginx all routes except index page does not work.

Laravel Config:

#/etc/nginx/sites-enabled/laravel
server {
    listen 80;

          


        
6条回答
  •  庸人自扰
    2020-12-24 02:52

    I had the same issue, but updating the default configuration made it work.

    location @rewrite {
            rewrite ^/(.*)$ /index.php?_url=/$1;
        }
        location / {
                try_files $uri $uri/ @rewrite;
        }  
    

    Let me know if this worked for you or not.
    sudo service nginx restart after changing the configuration.

提交回复
热议问题