-
Notifications
You must be signed in to change notification settings - Fork 14
/
django.conf
47 lines (40 loc) · 1.18 KB
/
django.conf
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
server {
server_name example.com www.example.com;
listen 80;
listen 443;
# canonical domain
include /srv/example.com/nginx/conf/canonical_domain.conf;
# django admin (http auth)
location /admin/ {
include /srv/example.com/nginx/conf/http_auth_basic.conf;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass $scheme://127.0.0.1:8000;
}
location /media/ {
alias /usr/share/pyshared/django/contrib/admin/media/;
}
# django non-admin pages
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass $scheme://127.0.0.1:8000;
}
# logging
error_log /srv/example.com/nginx/log/error.log;
access_log /srv/example.com/nginx/log/access.log;
}
server {
server_name media.example.com;
listen 80;
listen 443;
# document root
location / {
root /srv/example.com/nginx/www/myproject/media;
}
# logging
error_log /srv/example.com/nginx/log/error.log;
access_log /srv/example.com/nginx/log/access.log;
}