-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
fxtumblr.nginx
61 lines (52 loc) · 2.11 KB
/
fxtumblr.nginx
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
# See https://flask.palletsprojects.com/en/2.3.x/deploying/nginx/
# Replace example.com with your instance's domain!
# Access log condition: don't log if status code is 2xx or 3xx
# (for privacy reasons). If you need logging, setting logging: true
# in the config is usually enough.
map $status $loggable {
~^[23] 0;
default 1;
}
# Uncomment the following if you want to have support for subdomains.
# (This server clause MUST go *before* the next one, since the next clause
# overrides the www subdomain.)
# server {
# listen 443 ssl http2;
# listen [::]:433 ssl http2;
# server_name ~^(?<blog>.*).example.com$;
#
# rewrite ^(/post/)(.*)$ https://example.com/$blog/$2 last;
# return 301 https://example.com$request_uri;
#
# ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
# ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
# add_header Strict-Transport-Security "max-age=15768000; includeSubDomains;" always;
#
# access_log /var/log/nginx/fxtumblr-access.log combined if=$loggable;
# }
server {
listen 443 ssl http2;
listen [::]:433 ssl http2;
# Add the www. subdomain here if you intend to use subdomains (see above):
# server_name www.example.com example.com;
server_name example.com;
location / {
proxy_pass http://127.0.0.1:7878/; # feel free to change the port
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Prefix /;
}
# SSL certificate for domain goes here:
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
add_header Strict-Transport-Security "max-age=15768000; includeSubDomains;" always;
access_log /var/log/nginx/fxtumblr-access.log combined if=$loggable;
}
server {
listen 80;
listen [::]:80;
server_name *.example.com example.com;
return 301 https://$host$request_uri;
access_log /var/log/nginx/fxtumblr-access.log combined if=$loggable;
}