I’m setting up new Laravel 5.4 project on a Ubuntu 16.04.3 x64 nginx machine. The index page works fine but when i try using any other route it takes me to a 404 page. In my development environment, the routes are working fine. I’m guessing it has to do with my server setup.
Below is my information for the server:
server {
listen 80;
listen [::]:80;
root /var/www/dev.drmanansala.com/public;
index index.php index;
server_name dev.drmanansala.com;
error_page 404 /404page.php;
location / {
try_files $uri $uri/ /$uri.php?$is_args$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
location ~ /\.ht {
deny all;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/dev.drmanansala.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/dev.drmanansala.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
if ($scheme != "https") {
return 301 https://$host$request_uri;
} # managed by Certbot
}
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Hello,
According to the official Laravel documentation the correct default configuration should be:
As far as I can see you would need to adjust your PHP-FPM part a little bit to include the extra fastcgi rules.
Hope that this helps! Regards, Bobby