Reputation: 1323
I have Laravel with NGINX
on my production server, I have added new routes and they work fine on the localhost
. But in production, it returns 404
by Laravel.
1. I have restart NGINX but still no result.
2. I look a the route list and they are present.
What is the problem and how can I fix it?
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/laravel/public;
index index.php index.html index.htm;
server_name www.somesite.jp;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
location ~ /\.ht {
deny all;
}
}
Upvotes: 0
Views: 247
Reputation: 1323
Ok, so it is my bad. Problem was that on the server there were different conditions and I was trying to get User::findOrFail($userId)
where ID didn't exist and it returns Laravel 404 error!
Upvotes: 0
Reputation: 404
With me, I have found that localhost often doesn't mind the case on routes, but in production, getting the case correct is important. Same true on Controller file names etc.
Upvotes: 1