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/organizations/$1/static/$2
|
15
|
=404;
|
16
|
}
|
17
|
|
18
|
location ~ ^/static/(.+) {
|
19
|
root /;
|
20
|
try_files /var/lib/u-auth/static/$1
|
21
|
/var/lib/u-auth/collectstatic/$1
|
22
|
=404;
|
23
|
}
|
24
|
|
25
|
|
26
|
location ~ ^/media/(.+)$ {
|
27
|
alias /var/lib/u-auth/media/$1;
|
28
|
}
|
29
|
|
30
|
location / {
|
31
|
proxy_pass http://unix:/var/run/u-auth/u-auth.sock;
|
32
|
proxy_set_header Host $http_host;
|
33
|
proxy_set_header X-Forwarded-SSL on;
|
34
|
proxy_set_header X-Forwarded-Protocol ssl;
|
35
|
proxy_set_header X-Forwarded-Proto https;
|
36
|
proxy_set_header X-Real-IP $remote_addr;
|
37
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
38
|
}
|
39
|
}
|
40
|
|
41
|
server {
|
42
|
listen 80;
|
43
|
server_name u-auth.example.org;
|
44
|
|
45
|
access_log /var/log/nginx/u-auth.example.org-access.log combined;
|
46
|
error_log /var/log/nginx/u-auth.example.org-error.log;
|
47
|
|
48
|
location ~ ^/static/(.+)$ {
|
49
|
root /;
|
50
|
try_files /var/lib/u-auth/static/$1
|
51
|
/var/lib/u-auth/collectstatic/$1
|
52
|
=404;
|
53
|
}
|
54
|
|
55
|
location ~ ^/media/(.+)$ {
|
56
|
alias /var/lib/u-auth/media/$1;
|
57
|
}
|
58
|
|
59
|
location / {
|
60
|
proxy_pass http://unix:/var/run/u-auth/u-auth.sock;
|
61
|
proxy_set_header Host $http_host;
|
62
|
proxy_set_header X-Real-IP $remote_addr;
|
63
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
64
|
}
|
65
|
}
|