|
map $http_upgrade $connection_upgrade { |
|
default upgrade; |
|
'' close; |
|
} |
|
|
|
map $http_x_forwarded_proto $forwarded_protocol { |
|
default $scheme; |
|
|
|
# Only allow the values 'http' and 'https' for the X-Forwarded-Proto header. |
|
http http; |
|
https https; |
|
} |
|
|
|
upstream immich_server { |
|
server 127.0.0.1:3001; |
|
keepalive 2; |
|
} |
|
|
|
server { |
|
listen 80; |
|
server_name immich.domain.tld; |
|
return 301 https://$host$request_uri; |
|
} |
|
|
|
server { |
|
# when adding additional server blocks, omit 'reuseport' |
|
# listen 443 quic |
|
listen 443 quic reuseport; |
|
listen 443 ssl; |
|
http2 on; |
|
server_name immich.domain.tld; |
|
|
|
# use a variable to store the upstream proxy |
|
# in this example we are using a hostname which is resolved via DNS |
|
# (if you aren't using DNS remove the resolver line and change the variable to point to an IP address e.g `set $immich 127.0.0.1`) |
|
#resolver 127.0.0.1 valid=30; |
|
|
|
include /etc/nginx/http3.conf; |
|
|
|
ssl_certificate /letsencrypt/live/immich.domain.tld/fullchain.pem; |
|
ssl_certificate_key /letsencrypt/live/immich.domain.tld/privkey.pem; |
|
ssl_trusted_certificate /letsencrypt/live/immich.domain.tld/chain.pem; |
|
|
|
# Security / XSS Mitigation Headers |
|
# NOTE: X-Frame-Options may cause issues with the webOS app |
|
add_header X-Frame-Options "SAMEORIGIN"; |
|
add_header X-XSS-Protection "1; mode=block"; |
|
add_header X-Content-Type-Options "nosniff"; |
|
|
|
# Content Security Policy |
|
# See: https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP |
|
# Enforces https content and restricts JS/CSS to origin |
|
# External Javascript (such as cast_sender.js for Chromecast) must be whitelisted. |
|
# NOTE: The default CSP headers may cause issues with the webOS app |
|
#add_header Content-Security-Policy "default-src https: data: blob: http://image.tmdb.org; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' https://www.gstatic.com/cv/js/sender/v1/cast_sender.js https://www.gstatic.com/eureka/clank/95/cast_sender.js https://www.gstatic.com/eureka/clank/96/cast_sender.js https://www.gstatic.com/eureka/clank/97/cast_sender.js https://www.youtube.com blob:; worker-src 'self' blob:; connect-src 'self'; object-src 'none'; frame-ancestors 'self'"; |
|
|
|
# enable Letsencrypt validation |
|
include /etc/nginx/letsencrypt-acme-challenge.conf; |
|
|
|
# Disable gzip --> BREACH |
|
#gzip off; |
|
#gzip_comp_level 2; |
|
#gzip_min_length 1000; |
|
#gzip_proxied any; |
|
#gzip_vary on; |
|
#gunzip on; |
|
|
|
# text/html is included by default |
|
#gzip_types |
|
# application/javascript |
|
# application/json |
|
# font/ttf |
|
# image/svg+xml |
|
# text/css; |
|
|
|
client_max_body_size 50000M; |
|
|
|
location / { |
|
proxy_buffering off; |
|
proxy_request_buffering off; |
|
proxy_buffer_size 16k; |
|
proxy_busy_buffers_size 24k; |
|
proxy_buffers 64 4k; |
|
proxy_force_ranges on; |
|
|
|
proxy_set_header Host $host; |
|
proxy_redirect http:// https://; |
|
proxy_http_version 1.1; |
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
|
proxy_set_header Upgrade $http_upgrade; |
|
proxy_set_header Connection $connection_upgrade; |
|
|
|
#proxy_http_version 1.1; |
|
#proxy_set_header Host $http_host; |
|
#proxy_set_header X-Forwarded-Host $http_host; |
|
#proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
|
#proxy_set_header X-Forwarded-Proto $forwarded_protocol; |
|
#proxy_set_header Upgrade $http_upgrade; |
|
#proxy_set_header Connection $connection_upgrade; |
|
|
|
proxy_pass http://immich_server; |
|
} |
|
|
|
} |