server {
listen 80;
server_name _;
root /var/www/test-site/public;
index index.php index.html;
server_tokens off;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_pass unix:/run/php/php8.3-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_hide_header X-Powered-By;
}
location ~ /\. {
deny all;
}
location ~* \.(env|log|ini|conf)$ {
deny all;
}
location ~* /uploads/.*\.php$ {
deny all;
}
}