server { listen 80 default_server; root /var/www/html; index index.php index.html; charset utf-8; server_name _; #Logging access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log notice; #handling Static files location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt)$ { access_log off; expires max; } # Support Clean (aka Search Engine Friendly) URLs location / { try_files $uri $uri/ /index.php?$args ; } # Only index.php can execute PHP — all others blocked location = /index.php { include fastcgi_params; fastcgi_pass unix:/run/php/php8.5-fpm.sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } location ~ \.php$ { return 404; } }