server { listen 80 default_server; listen [::]:80 default_server; server_name _; root /var/www/atheos; index index.php index.html; access_log /var/log/nginx/atheos.access.log; error_log /var/log/nginx/atheos.error.log; # --- PHP ----------------------------------------------------------------- # The socket path here MUST byte-match the pool's `listen =` in # /etc/php83/php-fpm.d/www.conf # (interface I-1 — a mismatch yields a bare 502 with no other diagnostic). location ~ \.php$ { try_files $uri =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/run/php-fpm83/php-fpm.sock; fastcgi_index index.php; include fastcgi.conf; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } location / { try_files $uri $uri/ =404; } # --- hardening ----------------------------------------------------------- location ~ /\.git { deny all; } location ~ /\.ssh { deny all; } location ~ /\. { deny all; } location ~ ^/data/ { deny all; } location ~ ^/(config\.php|common\.php|controller\.php|traits/) { deny all; } location ~* \.(md|py|sh|log|conf|ini|sql|bak|orig)$ { deny all; } add_header X-Content-Type-Options "nosniff" always; add_header X-Frame-Options "SAMEORIGIN" always; add_header Referrer-Policy "strict-origin-when-cross-origin" always; client_max_body_size 64m; }