Correct NGINX downloading files instead of showing 404 for non-existing URL routes

This commit is contained in:
Alex Tselegidis 2023-07-10 15:18:44 +02:00
parent 5473544258
commit a9e7cea12a

View file

@ -7,14 +7,14 @@ server {
access_log /var/log/nginx/application.access.log; access_log /var/log/nginx/application.access.log;
root /var/www/html/.; root /var/www/html;
index index.php; index index.php index.html;
# try to serve file directly, fallback to index.php # try to serve file directly, fallback to index.php
location / { location / {
try_files $uri $uri/ /index.php$is_args$args =404; try_files $uri $uri/ =404;
} }
location ~ ^.+.php { location ~ ^.+.php {
@ -27,4 +27,8 @@ server {
fastcgi_buffer_size 32k; fastcgi_buffer_size 32k;
include fastcgi_params; include fastcgi_params;
} }
location ~ /\.ht {
deny all;
}
} }