Files
lahrcarpetcleaning.com/infra/nginx.conf
T
2026-05-21 18:51:47 +02:00

55 lines
1.8 KiB
Nginx Configuration File

server {
listen 80;
server_name lahrcarpetcleaning.com www.lahrcarpetcleaning.com;
root /usr/share/nginx/html;
index index.html;
# Security headers
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-XSS-Protection "1; mode=block" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
add_header Permissions-Policy "geolocation=(), microphone=(), camera=()" always;
add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src 'self' https://fonts.gstatic.com; img-src 'self' data:; media-src 'self'; connect-src 'self'; frame-ancestors 'none';" always;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
# Remove server version fingerprint
server_tokens off;
# Block dot files and hidden directories
location ~ /\. {
deny all;
return 404;
}
# Block tools directory
location ^~ /tools/ {
deny all;
return 404;
}
# Block sensitive file types
location ~* \.(env|log|sh|py|pyc|md|yml|yaml|conf|dockerfile|dockerignore|bak|backup|sql|key|pem|json|planning|cpanel)$ {
deny all;
return 404;
}
# Block README and Dockerfile at root
location ~* ^/(README|Dockerfile|docker-compose\.yml|\.cpanel\.yml)$ {
deny all;
return 404;
}
location / {
try_files $uri $uri/ $uri/index.html =404;
}
error_page 404 /404.html;
error_page 500 502 503 504 /500.html;
location ~* \.(jpg|jpeg|png|gif|ico|css|js|svg|webp|woff|woff2|ttf|mp4|webm)$ {
expires 30d;
add_header Cache-Control "public, immutable";
}
}