1
|
server {
|
2
|
listen 443;
|
3
|
server_name u-auth.example.org;
|
4
|
|
5
|
ssl on;
|
6
|
ssl_certificate /etc/ssl/certs/ssl-cert-snakeoil.pem;
|
7
|
ssl_certificate_key /etc/ssl/private/ssl-cert-snakeoil.key;
|
8
|
|
9
|
access_log /var/log/nginx/u-auth.example.org-access.log combined;
|
10
|
error_log /var/log/nginx/u-auth.example.org-error.log;
|
11
|
|
12
|
location ~ ^/static/(.+)$ {
|
13
|
root /;
|
14
|
try_files /var/lib/u-auth/static/$1
|
15
|
/var/lib/u-auth/collectstatic/$1
|
16
|
=404;
|
17
|
}
|
18
|
|
19
|
location ~ ^/media/(.+)$ {
|
20
|
alias /var/lib/u-auth/media/$1;
|
21
|
}
|
22
|
|
23
|
location / {
|
24
|
proxy_pass http://unix:/var/run/u-auth/u-auth.sock;
|
25
|
proxy_set_header Host $http_host;
|
26
|
proxy_set_header X-Forwarded-SSL on;
|
27
|
proxy_set_header X-Forwarded-Protocol ssl;
|
28
|
proxy_set_header X-Forwarded-Proto https;
|
29
|
proxy_set_header X-Real-IP $remote_addr;
|
30
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
31
|
}
|
32
|
}
|
33
|
|
34
|
server {
|
35
|
listen 80;
|
36
|
server_name u-auth.example.org;
|
37
|
|
38
|
access_log /var/log/nginx/u-auth.example.org-access.log combined;
|
39
|
error_log /var/log/nginx/u-auth.example.org-error.log;
|
40
|
|
41
|
location ~ ^/static/(.+)$ {
|
42
|
root /;
|
43
|
try_files /var/lib/u-auth/static/$1
|
44
|
/var/lib/u-auth/collectstatic/$1
|
45
|
=404;
|
46
|
}
|
47
|
|
48
|
location ~ ^/media/(.+)$ {
|
49
|
alias /var/lib/u-auth/media/$1;
|
50
|
}
|
51
|
|
52
|
location / {
|
53
|
proxy_pass http://unix:/var/run/u-auth/u-auth.sock;
|
54
|
proxy_set_header Host $http_host;
|
55
|
proxy_set_header X-Real-IP $remote_addr;
|
56
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
57
|
}
|
58
|
}
|