Today, I have a problem with NGINX.
In my NGINX config I have this :
location ~ / {
try_files $uri $uri/ /index.php?$query_string;
}
For example, I want to access https://my.domain/hello with a route defined with Laravel. It works
but now if I access https://my.domain/hello/ it returns a 404 NGINX error page. I also point out that I use Plesk.
Do you have any ideas on how to fix that ?
Thank you for your time 😉
2
Answers
Add 301 redirect if path is not directory and ending on
/
If you check the nginx config template you will find this line
/usr/local/psa/admin/conf/templates/default/domain/nginxDomainVirtualHost.php
You either need to reenable proxy mode (it will reenable apache but nginx will still be receiving the request in the first place) or create a custom template for your domain and delete this line
This will not concern you, but if you were not using php (eg: nodejs), you could also disable php support, which would also get rid of this line