Advertisement
Guest User

ExampleConf

a guest
Jul 30th, 2016
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nginx 1.22 KB | None | 0 0
  1. upstream server {
  2.    server unix:/var/run/gunicorn.sock fail_timeout=0;
  3. }
  4.  
  5. server {
  6.  
  7.     listen   80;
  8.     server_name example.com;
  9.  
  10.     client_max_body_size 4G;
  11.  
  12.     access_log /var/log/nginx/access.log;
  13.     error_log /var/log/nginx/error.log;
  14.  
  15.  
  16.     location /static/ {
  17.         alias   /home/user/sites/example.com/www/assets/;
  18.         expires 1M;
  19.         access_log off;
  20.         add_header Cache-Control "public";
  21.     }
  22.  
  23.     location /media/ {
  24.         alias   /home/user/sites/example.com/www/media/;
  25.         expires 1M;
  26.         access_log off;
  27.         add_header Cache-Control "public";
  28.     }
  29.  
  30.  
  31.   location / {
  32.  
  33.     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  34.     proxy_set_header Host $http_host;
  35.     proxy_redirect off;
  36.     proxy_connect_timeout 600;
  37.     proxy_read_timeout 600;
  38.  
  39.     # Try to serve static files from nginx, no point in making an
  40.     # *application* server like Unicorn/Rainbows! serve static files.
  41.     if (!-f $request_filename) {
  42.         proxy_pass http://server;
  43.         break;
  44.     }
  45.  
  46.     add_header Access-Control-Allow-Origin *;
  47.  
  48.   }
  49.  
  50.   # Error pages
  51.   error_page 500 502 503 504 /500.html;
  52.   location = /502.html {
  53.     root /usr/share/nginx/html/;
  54.   }
  55.  
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement