Files
eCommerce-website/nginx.conf
2026-02-19 18:34:10 +05:30

32 lines
838 B
Nginx Configuration File

server {
listen 80;
server_name _;
root /usr/share/nginx/html;
index index.html;
# Gzip compression
gzip on;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
gzip_min_length 1024;
# Cache static assets aggressively
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|avif|webp|woff|woff2|ttf|eot)$ {
expires 1y;
add_header Cache-Control "public, immutable";
try_files $uri =404;
}
# SPA fallback: send all unmatched routes to index.html
location / {
try_files $uri $uri/ /index.html;
}
# Disable access logs for health probes (optional)
location /healthz {
access_log off;
return 200 "ok";
add_header Content-Type text/plain;
}
}