blob: 9f20a5f1aeb91179712dde5234c312b788d92e90 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
worker_processes auto;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80 default_server;
server_name _;
location / {
return 404;
}
}
{% for site in static_sites -%}
{% if site.tls -%}
server {
server_name {{ site.host }};
root /usr/local/www/{{ site.site }};
listen 443 ssl;
listen [::]:443 ssl;
http2 on;
index index.html;
location / {
try_files $uri $uri.html $uri/ =404;
}
# 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;
access_log /var/log/nginx/{{ site.site }}/access.log;
error_log /var/log/nginx/{{ site.site }}/error.log;
ssl_certificate /usr/local/etc/letsencrypt/live/{{ site.host }}/fullchain.pem;
ssl_certificate_key /usr/local/etc/letsencrypt/live/{{ site.host }}/privkey.pem;
include /usr/local/etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /usr/local/etc/letsencrypt/ssl-dhparams.pem;
}
server {
listen 80;
server_name {{ site.host }};
return 301 https://$host$request_uri;
access_log /var/log/nginx/{{ site.site }}/access.log;
error_log /var/log/nginx/{{ site.site }}/error.log;
}
{% else %}
server {
server_name {{ site.host }};
root /usr/local/www/{{ site.site }};
listen 80;
http2 on;
index index.html;
location / {
try_files $uri $uri.html $uri/ =404;
}
access_log /var/log/nginx/{{ site.site }}/access.log;
error_log /var/log/nginx/{{ site.site }}/error.log;
}
{% endif -%}
{% endfor -%}
{% for jail in jails -%}
server {
server_name {{ jail.name }}.jan.systems;
http2 on;
{% if "tls" in jail and jail.tls -%}
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;
ssl_certificate /usr/local/etc/letsencrypt/live/{{ jail.name }}.jan.systems/fullchain.pem;
ssl_certificate_key /usr/local/etc/letsencrypt/live/{{ jail.name }}.jan.systems/privkey.pem;
include /usr/local/etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /usr/local/etc/letsencrypt/ssl-dhparams.pem;
{% else %}
listen 80;
{% endif %}
location / {
proxy_pass http://192.168.2.{{ jail.num }};
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;
}
}
{% endfor %}
}
|