Project

General

Profile

Download (1.94 KB) Statistics
| Branch: | Tag: | Revision:

root / debian / nginx-example.conf @ 940f714d

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
                      /var/lib/u-auth/static/$2
16
                      /var/lib/u-auth/collectstatic/$2
17
                      =404;
18
        }
19

    
20
        location ~ ^/media/(.+)$ {
21
            alias /var/lib/u-auth/media/$1;
22
        }
23

    
24
        location / {
25
            proxy_pass         http://unix:/var/run/u-auth/u-auth.sock;
26
            proxy_set_header   Host $http_host;
27
            proxy_set_header   X-Forwarded-SSL on;
28
            proxy_set_header   X-Forwarded-Protocol ssl;
29
            proxy_set_header   X-Forwarded-Proto https;
30
            proxy_set_header   X-Real-IP       $remote_addr;
31
            proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
32
        }
33
}
34

    
35
server {
36
        listen   80;
37
        server_name  u-auth.example.org;
38

    
39
        access_log  /var/log/nginx/u-auth.example.org-access.log combined;
40
        error_log  /var/log/nginx/u-auth.example.org-error.log;
41

    
42
        location ~ ^/static/(.+)$ {
43
            root /;
44
            try_files /var/lib/u-auth/static/$1
45
                      /var/lib/u-auth/collectstatic/$1
46
                      =404;
47
        }
48

    
49
        location ~ ^/media/(.+)$ {
50
            alias /var/lib/u-auth/media/$1;
51
        }
52

    
53
        location / {
54
            proxy_pass         http://unix:/var/run/u-auth/u-auth.sock;
55
            proxy_set_header   Host $http_host;
56
            proxy_set_header   X-Real-IP       $remote_addr;
57
            proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
58
        }
59
}
(5-5/16)