55 lines
1.6 KiB
Plaintext
55 lines
1.6 KiB
Plaintext
server {
|
|
listen 8001;
|
|
# TODO Change next line. Set the document path which mounted in nginx container.
|
|
root /var/www/example.com/public;
|
|
|
|
# security headers
|
|
add_header X-XSS-Protection "1; mode=block" always;
|
|
add_header X-Content-Type-Options "nosniff" always;
|
|
add_header Referrer-Policy "no-referrer-when-downgrade" always;
|
|
add_header Content-Security-Policy "default-src 'self' http: https: ws: wss: data: blob: 'unsafe-inline'; frame-ancestors 'self';" always;
|
|
add_header Permissions-Policy "interest-cohort=()" always;
|
|
|
|
# . files
|
|
location ~ /\.(?!well-known) {
|
|
deny all;
|
|
}
|
|
|
|
# logging
|
|
access_log /var/log/nginx/access.log combined buffer=512k flush=1m;
|
|
error_log /var/log/nginx/error.log warn;
|
|
|
|
# gzip
|
|
gzip on;
|
|
gzip_vary on;
|
|
gzip_proxied any;
|
|
gzip_comp_level 6;
|
|
gzip_types text/plain text/css text/xml application/json application/javascript application/rss+xml application/atom+xml image/svg+xml;
|
|
|
|
# index.html fallback
|
|
location / {
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
|
|
# additional config
|
|
# favicon.ico
|
|
location = /favicon.ico {
|
|
log_not_found off;
|
|
}
|
|
|
|
# robots.txt
|
|
location = /robots.txt {
|
|
log_not_found off;
|
|
}
|
|
|
|
# assets, media
|
|
location ~* \.(?:css(\.map)?|js(\.map)?|jpe?g|png|gif|ico|cur|heic|webp|tiff?|mp3|m4a|aac|ogg|midi?|wav|mp4|mov|webm|mpe?g|avi|ogv|flv|wmv)$ {
|
|
expires 7d;
|
|
}
|
|
|
|
# svg, fonts
|
|
location ~* \.(?:svgz?|ttf|ttc|otf|eot|woff2?)$ {
|
|
add_header Access-Control-Allow-Origin "*";
|
|
expires 7d;
|
|
}
|
|
} |