Files
Velocity-OS/webos/nginx.conf

38 lines
1.3 KiB
Nginx Configuration File

server {
listen 80;
server_name _;
root /usr/share/nginx/html;
index index.html;
# Health check endpoint (no logging)
location = /health.txt {
access_log off;
return 200 "ok\n";
add_header Content-Type text/plain;
}
# React Router — all non-asset paths serve index.html
location / {
try_files $uri $uri/ /index.html;
}
# Static assets — aggressive caching (Vite hashes filenames)
location ~* \.(js|css|woff2?|ttf|eot|svg|png|jpg|jpeg|gif|ico|wasm)$ {
expires 1y;
add_header Cache-Control "public, immutable";
access_log off;
}
# Security headers
add_header X-Frame-Options "DENY" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" 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: blob:; connect-src 'self' wss:;" always;
# Gzip
gzip on;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript application/wasm;
gzip_min_length 1000;
}