-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnginx.conf
79 lines (65 loc) · 1.87 KB
/
nginx.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# see http://djangoadvent.com/1.2/deploying-django-site-using-fastcgi/
# see http://wiki.nginx.org/NginxConfiguration
server {
listen 80;
server_name project_name.de;
rewrite ^/(.*) http://www.project_name.de/$1 permanent;
}
upstream project_name_app_server { # this works with gunicorn; name must be unique if you run several projects!
server 127.0.0.1:8001 fail_timeout=0; # change port!
}
server {
listen 80;
server_name www.project_name.de;
access_log /var/www/project_name/logs/access.log;
error_log /var/www/project_name/logs/error.log;
location /static {
root /var/www/project_name/releases/current/project_name;
expires 24h;
break;
}
location /favicon.ico {
root /var/www/project_name/releases/current/project_name/static;
expires 24h;
break;
}
location /django_admin_media {
rewrite ^/django_admin_media/(.*) /admin/media/$1 permanent;
}
location /admin/media/ {
root /var/www/project_name/lib/python2.5/site-packages/django/contrib;
expires 14d;
break;
}
location /feincms_admin_media {
rewrite ^/feincms_admin_media/(.*) /media/feincms/$1 permanent;
}
location /medialibrary {
root /var/www/project_name;
expires 24h;
break;
}
location /media/feincms {
root /var/www/project_name/lib/python2.5/site-packages/feincms/feincms;
expires 24h;
break;
}
location /site_media { # project media
rewrite ^/site_media/(.*) /static/$1 permanent;
break;
}
location /media { # project media
rewrite ^/media/(.*) /static/$1 permanent;
break;
}
location / {
include /etc/nginx/fastcgi_params; # SCRIPT_INFO must not be defined!
if (!-f $request_filename) { # gunicorn
proxy_pass http://project_name_app_server;
#proxy_buffering off; # for streaming
break;
}
#fastcgi_pass 127.0.0.1:8001; # for fcgi / Change port!
break;
}
}