Files

90 lines
2.5 KiB
Nginx Configuration File

user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log notice;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
server_tokens off;
add_header Cache-Control "no-cache";
etag on;
# Security headers. They are inherited by every location below as long
# as the location does not declare its own add_header.
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "no-referrer" always;
include /etc/nginx/csp-headers.conf;
# include /etc/nginx/conf.d/*.conf;
server {
listen 80;
# Rewrites the nonce placeholder. Precompressed bytes and 304s would keep an old nonce.
location = /index.html {
root /usr/share/nginx/html;
gzip_static off;
etag off;
if_modified_since off;
sub_filter_once off;
sub_filter '__CSP_NONCE__' '$request_id';
}
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
# Self-hosted ES modules (web/js): the stock mime.types does not map
# .mjs, and browsers refuse module scripts served as octet-stream.
location ~* \.mjs$ {
root /usr/share/nginx/html;
types { }
default_type application/javascript;
}
# The mail viewer iframe is sandboxed (opaque origin): font loads are CORS.
# add_header here drops inherited ones; nosniff and Referrer-Policy are
# repeated, the report-only CSP header is not.
location ~* \.(ttf|otf|woff2?)$ {
root /usr/share/nginx/html;
add_header Access-Control-Allow-Origin "*" always;
add_header Cache-Control "no-cache";
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "no-referrer" always;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
gzip_static on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_http_version 1.1;
}