2011-11-18 09:13:30 -08:00
|
|
|
server {
|
|
|
|
server_name newsblur.com;
|
|
|
|
rewrite ^(.*) http://www.newsblur.com$1 permanent;
|
|
|
|
}
|
|
|
|
|
2011-08-26 09:35:02 -07:00
|
|
|
upstream app_server {
|
2011-11-01 10:32:11 -07:00
|
|
|
server 127.0.0.1:8000 fail_timeout=10 max_fails=3 ;
|
2011-11-18 09:13:30 -08:00
|
|
|
server app02.newsblur.com:80 fail_timeout=10 max_fails=3;
|
2011-11-01 10:32:11 -07:00
|
|
|
# server db01.newsblur.com:80 fail_timeout=10 max_fails=3 down;
|
|
|
|
}
|
|
|
|
|
2011-11-18 09:13:30 -08:00
|
|
|
# limit_req_zone $remote_addr zone=one:10m rate=200r/m;
|
|
|
|
# limit_req zone=one burst=200 nodelay;
|
2011-08-26 09:35:02 -07:00
|
|
|
|
|
|
|
server {
|
|
|
|
listen 80 default;
|
|
|
|
client_max_body_size 4M;
|
2011-11-01 10:32:11 -07:00
|
|
|
server_name www.newsblur.com;
|
2011-11-18 09:13:30 -08:00
|
|
|
|
|
|
|
if ($host = 'newsblur.com' ) {
|
|
|
|
rewrite ^/(.*)$ http://www.newsblur.com/$1 permanent;
|
|
|
|
}
|
|
|
|
|
2011-08-26 09:35:02 -07:00
|
|
|
location /media/admin/ {
|
|
|
|
alias /usr/local/lib/python2.6/dist-packages/Django-1.2.5-py2.6.egg/django/contrib/admin/media/;
|
|
|
|
}
|
2011-11-18 09:13:30 -08:00
|
|
|
|
2011-08-26 09:35:02 -07:00
|
|
|
location /media/ {
|
|
|
|
expires max;
|
|
|
|
keepalive_timeout 1;
|
|
|
|
root /home/sclay/newsblur;
|
|
|
|
}
|
2011-11-18 09:13:30 -08:00
|
|
|
|
2011-08-26 09:35:02 -07:00
|
|
|
location /favicon.ico {
|
|
|
|
alias /home/sclay/newsblur/media/img/favicon.png;
|
|
|
|
expires max;
|
|
|
|
access_log off;
|
|
|
|
}
|
|
|
|
|
|
|
|
location ^~ /crossdomain.xml {
|
|
|
|
expires max;
|
|
|
|
alias /home/sclay/newsblur/media/crossdomain.xml;
|
|
|
|
types {
|
|
|
|
text/x-cross-domain-policy xml;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
location ^~ /robots.txt {
|
|
|
|
expires max;
|
|
|
|
alias /home/sclay/newsblur/media/robots.txt;
|
|
|
|
}
|
|
|
|
|
|
|
|
location /munin/ {
|
|
|
|
alias /var/cache/munin/www/;
|
|
|
|
}
|
|
|
|
|
|
|
|
location / {
|
|
|
|
if (-f /home/sclay/newsblur/media/maintenance.html) {
|
2011-11-18 09:13:30 -08:00
|
|
|
return 503;
|
2011-08-26 09:35:02 -07:00
|
|
|
}
|
2011-11-18 09:13:30 -08:00
|
|
|
|
|
|
|
error_page 503 @maintenance;
|
|
|
|
location @maintenance {
|
|
|
|
rewrite ^(.*)$ /home/sclay/newsblur/media/maintenance.html break;
|
|
|
|
}
|
|
|
|
|
2011-08-26 09:35:02 -07:00
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
|
proxy_set_header Host $http_host;
|
|
|
|
proxy_redirect off;
|
|
|
|
|
|
|
|
if (!-f $request_filename) {
|
|
|
|
proxy_pass http://app_server;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-11-18 09:13:30 -08:00
|
|
|
}
|
|
|
|
|