bin/server/templates/nginx.conf.j2
author Luke Hoersten <luke@hoersten.org>
Sat, 10 Feb 2024 15:41:05 -0600
changeset 230 07f08cc98da0
parent 228 ff776d663062
permissions -rw-r--r--
Added swapfile role.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
228
ff776d663062 Added pastebin bin role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     1
server {
ff776d663062 Added pastebin bin role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     2
    listen 80;
ff776d663062 Added pastebin bin role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     3
    listen [::]:80;
ff776d663062 Added pastebin bin role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     4
    server_name {{nginx_server_name}};
ff776d663062 Added pastebin bin role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     5
    return 301 https://$host$request_uri;
ff776d663062 Added pastebin bin role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     6
}
ff776d663062 Added pastebin bin role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     7
ff776d663062 Added pastebin bin role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     8
server {
ff776d663062 Added pastebin bin role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     9
    listen 443 ssl http2;
ff776d663062 Added pastebin bin role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    10
    # listen [::]:443 ssl ipv6only=on;
ff776d663062 Added pastebin bin role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    11
    server_name {{nginx_server_name}};
ff776d663062 Added pastebin bin role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    12
ff776d663062 Added pastebin bin role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    13
    ssl_certificate {{nginx_ssl_cert}};
ff776d663062 Added pastebin bin role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    14
    ssl_certificate_key {{nginx_ssl_privkey}};
ff776d663062 Added pastebin bin role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    15
    include /etc/letsencrypt/options-ssl-nginx.conf;
ff776d663062 Added pastebin bin role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    16
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
ff776d663062 Added pastebin bin role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    17
ff776d663062 Added pastebin bin role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    18
    ssl_ecdh_curve X25519:prime256v1:secp384r1:secp521r1;
ff776d663062 Added pastebin bin role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    19
    ssl_stapling on;
ff776d663062 Added pastebin bin role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    20
    ssl_stapling_verify on;
ff776d663062 Added pastebin bin role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    21
ff776d663062 Added pastebin bin role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    22
    location / {
ff776d663062 Added pastebin bin role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    23
        proxy_pass http://127.0.0.1:{{nginx_proxy_port}};
ff776d663062 Added pastebin bin role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    24
        proxy_redirect off;
ff776d663062 Added pastebin bin role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    25
        proxy_set_header Host $host;
ff776d663062 Added pastebin bin role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    26
        proxy_set_header X-Real-IP $remote_addr;
ff776d663062 Added pastebin bin role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    27
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
ff776d663062 Added pastebin bin role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    28
        proxy_set_header X-Forwarded-Proto $scheme;
ff776d663062 Added pastebin bin role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    29
    }
ff776d663062 Added pastebin bin role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    30
}