aboutsummaryrefslogtreecommitdiffstats
path: root/templates/ingress/usr_local_etc_nginx_nginx.conf.j2
diff options
context:
space:
mode:
authorJan Tuomi <jan@jantuomi.fi>2026-05-13 00:13:57 +0300
committerJan Tuomi <jan@jantuomi.fi>2026-05-16 18:42:27 +0300
commitb5860daf11ac353049cb1654b9414a129e5cfb96 (patch)
tree87ed89711e4f0e85ace0a97fa123199152c67302 /templates/ingress/usr_local_etc_nginx_nginx.conf.j2
parent4715a28fdcd87440400d17154bfa361d99db29cc (diff)
Rework
Diffstat (limited to 'templates/ingress/usr_local_etc_nginx_nginx.conf.j2')
-rw-r--r--templates/ingress/usr_local_etc_nginx_nginx.conf.j2141
1 files changed, 0 insertions, 141 deletions
diff --git a/templates/ingress/usr_local_etc_nginx_nginx.conf.j2 b/templates/ingress/usr_local_etc_nginx_nginx.conf.j2
deleted file mode 100644
index 16299ef..0000000
--- a/templates/ingress/usr_local_etc_nginx_nginx.conf.j2
+++ /dev/null
@@ -1,141 +0,0 @@
-worker_processes auto;
-
-events {
- worker_connections 1024;
-}
-
-http {
- include mime.types;
- default_type application/octet-stream;
-
- sendfile on;
- keepalive_timeout 65;
-
- log_format vcombined '$host:$server_port '
- '$remote_addr - $remote_user [$time_local] '
- '"$request" $status $body_bytes_sent '
- '"$http_referer" "$http_user_agent"';
-
- access_log /var/log/nginx/access.log vcombined;
-
- gzip on;
- gzip_vary on;
- gzip_min_length 512;
- gzip_types
- text/plain
- text/css
- application/json
- application/javascript
- application/xml
- image/svg+xml;
-
- server {
- listen 80 default_server;
- server_name _;
-
- include /usr/local/etc/nginx/snippets/ban.inc;
-
- location / {
- return 404;
- }
- }
-
- {% for route in ingress_routes -%}
- server {
- listen 80;
- listen [::]:80;
- server_name {{ route.host }};
-
- include /usr/local/etc/nginx/snippets/ban.inc;
-
- return 307 https://$host$request_uri;
- }
-
- server {
- server_name {{ route.host }};
- http2 on;
-
- include /usr/local/etc/nginx/snippets/ban.inc;
-
- listen 443 ssl;
- listen [::]:443 ssl;
-
- # See https://ssl-config.mozilla.org/#server=nginx&version=1.28.0&config=intermediate&openssl=3.4.0&guideline=5.7
- add_header Strict-Transport-Security "max-age=63072000" always;
-
- # Common hardening headers
- add_header X-Content-Type-Options nosniff always;
- add_header X-Frame-Options DENY always;
- add_header Referrer-Policy strict-origin-when-cross-origin always;
- add_header Permissions-Policy interest-cohort=();
-
- # Hide "Server: nginx/1.28.0" header
- server_tokens off;
-
- ssl_certificate /usr/local/etc/letsencrypt/live/{{ cert_name }}/fullchain.pem;
- ssl_certificate_key /usr/local/etc/letsencrypt/live/{{ cert_name }}/privkey.pem;
- include /usr/local/etc/letsencrypt/options-ssl-nginx.conf;
- ssl_dhparam /usr/local/etc/letsencrypt/ssl-dhparams.pem;
-
- {% if route.jail is defined -%}
- {% for jail in jails if jail.name == route.jail -%}
- location / {
- proxy_pass http://192.168.2.{{ jail.num }}{% if route.port is defined %}:{{ route.port }}{% endif %};
- proxy_set_header Host $host;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_set_header X-Forwarded-Proto $scheme;
- {% if jail.name == 'irc_thelounge' -%}
- proxy_http_version 1.1;
- proxy_set_header Connection "Upgrade";
- proxy_set_header Upgrade $http_upgrade;
-
- # by default nginx times out connections in one minute
- proxy_read_timeout 1d;
- proxy_send_timeout 1d;
- proxy_buffering off;
- proxy_request_buffering off;
-
- client_max_body_size 100M;
- {% elif jail.name == 'plex' -%}
- proxy_http_version 1.1;
- proxy_set_header Connection "Upgrade";
- proxy_set_header Upgrade $http_upgrade;
-
- # Streaming-friendly behavior
- proxy_redirect off;
- proxy_buffering off;
-
- # Long streams / slow clients
- proxy_read_timeout 3600s;
- proxy_send_timeout 3600s;
- {% endif %}
- }
- {% endfor %}
- {% elif route.redirect is defined -%}
- return 307 https://{{ route.redirect }}$request_uri;
- {% elif route.ip is defined -%}
- location / {
- proxy_pass http://{{ route.ip }}:{{ route.port }};
- proxy_set_header Host $host;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_set_header X-Forwarded-Proto $scheme;
-
- # TODO: these shouldn't configured for all ip:port proxies but Immich needs them
- proxy_http_version 1.1;
- proxy_set_header Connection "upgrade";
- proxy_set_header Upgrade $http_upgrade;
-
- # by default nginx times out connections in one minute
- proxy_read_timeout 1d;
- proxy_send_timeout 1d;
- proxy_buffering off;
- proxy_request_buffering off;
-
- client_max_body_size 10G;
- }
- {% endif %}
- }
- {% endfor %}
-}