38 lines
972 B
Nginx Configuration File
38 lines
972 B
Nginx Configuration File
|
|
# Page Build System - Nginx Configuration
|
||
|
|
# Add this to your nginx server block
|
||
|
|
|
||
|
|
location / {
|
||
|
|
try_files $uri $uri/ =404;
|
||
|
|
|
||
|
|
# Cache static assets
|
||
|
|
location ~* \.(css|js|svg)$ {
|
||
|
|
expires 1y;
|
||
|
|
add_header Cache-Control "public, immutable";
|
||
|
|
}
|
||
|
|
|
||
|
|
# HTML files - shorter cache
|
||
|
|
location ~* \.html$ {
|
||
|
|
expires 1h;
|
||
|
|
add_header Cache-Control "public";
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
# Compression
|
||
|
|
gzip on;
|
||
|
|
gzip_vary on;
|
||
|
|
gzip_min_length 1024;
|
||
|
|
gzip_types
|
||
|
|
text/plain
|
||
|
|
text/css
|
||
|
|
text/xml
|
||
|
|
text/javascript
|
||
|
|
application/javascript
|
||
|
|
application/xml+rss
|
||
|
|
application/json
|
||
|
|
image/svg+xml;
|
||
|
|
|
||
|
|
# Security headers
|
||
|
|
add_header X-Content-Type-Options nosniff;
|
||
|
|
add_header X-Frame-Options DENY;
|
||
|
|
add_header X-XSS-Protection "1; mode=block";
|
||
|
|
add_header Content-Security-Policy "default-src '\''self'\''; style-src '\''self'\'' '\''unsafe-inline'\'' fonts.googleapis.com; font-src fonts.gstatic.com; img-src '\''self'\'' data:; script-src '\''none'\'';";
|