forked from postgres/pgweb
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpgweb.conf
More file actions
71 lines (59 loc) · 2.16 KB
/
Copy pathpgweb.conf
File metadata and controls
71 lines (59 loc) · 2.16 KB
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
# {{ ansible_managed }}
# PostgreSQL Chinese community website: Django/Gunicorn plus static assets.
upstream {{ upstream_name }} {
server {{ upstream.endpoint | replace('${admin_ip}', admin_ip) }} max_fails=0;
}
server {
listen {{ nginx_port | default(80) }};
server_name {{ upstream.domain }};
location ^~ /.well-known/acme-challenge/ {
root {{ nginx_home | default('/www') }}/acme;
try_files $uri =404;
}
location / {
return 301 https://$host$request_uri;
}
}
server {
listen {{ nginx_ssl_port | default(443) }} ssl;
http2 on;
server_name {{ upstream.domain }};
ssl_certificate {% if upstream.cert is defined %}{{ upstream.cert }}{% else %}/etc/nginx/conf.d/cert/{{ upstream.domain }}.crt{% endif %};
ssl_certificate_key {% if upstream.key is defined %}{{ upstream.key }}{% else %}/etc/nginx/conf.d/cert/{{ upstream.domain }}.key{% endif %};
ssl_protocols TLSv1.2 TLSv1.3;
ssl_session_timeout 1d;
access_log /var/log/nginx/{{ upstream.log | default('pgweb.log') }};
location ^~ /.well-known/acme-challenge/ {
root {{ nginx_home | default('/www') }}/acme;
try_files $uri =404;
}
location ^~ /media/admin/ {
alias {{ upstream.admin_static | default('/data/app/pgweb/static_collected/admin/') }};
expires 1h;
access_log off;
}
location ^~ /media/ {
alias {{ upstream.media_root | default('/data/app/pgweb/media/') }};
expires 1h;
access_log off;
}
location ^~ /files/ {
alias {{ upstream.files_root | default('/data/app/pgweb/static/') }};
expires 1h;
access_log off;
}
location / {
proxy_pass http://{{ upstream_name }}/;
proxy_set_header Host $host;
proxy_set_header X-Real-Scheme $scheme;
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;
proxy_connect_timeout 5s;
proxy_read_timeout 120s;
proxy_send_timeout 120s;
proxy_next_upstream error;
proxy_buffering on;
proxy_request_buffering on;
}
}