Skip to content

Instantly share code, notes, and snippets.

@davidalves1
Last active June 28, 2018 01:25
Show Gist options
  • Save davidalves1/977b8292461bb45cbb62cf07e3dd6733 to your computer and use it in GitHub Desktop.
Save davidalves1/977b8292461bb45cbb62cf07e3dd6733 to your computer and use it in GitHub Desktop.
Resolving the problem of the 404 error of Laravel with Nginx on Ubuntu Linux
server {
listen 80;
# listen [::]:80;
root /home/user/projects/my-site/public;
index index.php index.html index.htm;
server_name my-site.local;
location / {
# try_files $uri $uri/ /index.php?$query_string =404; <---------- WRONG
try_files $uri $uri/ /index.php$is_args$args; <---------- CORRECT
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.1-fpm.sock;
}
location ~ /\.ht {
deny all;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment