Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- upstream server {
- server unix:/var/run/gunicorn.sock fail_timeout=0;
- }
- server {
- listen 80;
- server_name example.com;
- client_max_body_size 4G;
- access_log /var/log/nginx/access.log;
- error_log /var/log/nginx/error.log;
- location /static/ {
- alias /home/user/sites/example.com/www/assets/;
- expires 1M;
- access_log off;
- add_header Cache-Control "public";
- }
- location /media/ {
- alias /home/user/sites/example.com/www/media/;
- expires 1M;
- access_log off;
- add_header Cache-Control "public";
- }
- location / {
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_set_header Host $http_host;
- proxy_redirect off;
- proxy_connect_timeout 600;
- proxy_read_timeout 600;
- # Try to serve static files from nginx, no point in making an
- # *application* server like Unicorn/Rainbows! serve static files.
- if (!-f $request_filename) {
- proxy_pass http://server;
- break;
- }
- add_header Access-Control-Allow-Origin *;
- }
- # Error pages
- error_page 500 502 503 504 /500.html;
- location = /502.html {
- root /usr/share/nginx/html/;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement