Advertisement
Guest User

Untitled

a guest
Feb 28th, 2015
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.13 KB | None | 0 0
  1. upstream hello_app_server {
  2.      # fail_timeout=0 means we always retry an upstream even if it failed
  3.      # to return a good HTTP response (in case the Unicorn master nukes a
  4.      # single worker for timing out).
  5.  
  6.     server unix:/home/ubuntu/webapps/django_projects/brandifier/brandy_project/run/gunicorn.sock fail_timeout=0;
  7. }
  8.  
  9. server {
  10.  
  11.     listen 80;
  12.     server_name example.com;
  13.  
  14.     client_max_body_size 4G;
  15.  
  16.     access_log /home/ubuntu/webapps/django_projects/brandifier/brandy_project/logs/nginx-access.log;
  17.     error_log /home/ubuntu/webapps/django_projects/brandifier/brandy_project/logs/nginx-error.log;
  18.  
  19.     location /static/ {
  20.          alias /home/ubuntu/webapps/django_projects/brandifier/brandy_project/static/;
  21.     }
  22.  
  23.     location /media/ {
  24.          alias /webapps/hello_django/media/;
  25.     }
  26.  
  27.     location / {
  28.          # an HTTP header important enough to have its own Wikipedia entry:
  29.          # http://en.wikipedia.org/wiki/X-Forwarded-For
  30.          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  31.  
  32.          # enable this if and only if you use HTTPS, this helps Rack
  33.          # set the proper protocol for doing redirects:
  34.          # proxy_set_header X-Forwarded-Proto https;
  35.  
  36.          # pass the Host: header from the client right along so redirects
  37.          # can be set properly within the Rack application
  38.          proxy_set_header Host $http_host;
  39.  
  40.          # we don't want nginx trying to do something clever with
  41.          # redirects, we set the Host: header above already.
  42.          proxy_redirect off;
  43.  
  44.          # set "proxy_buffering off" *only* for Rainbows! when doing
  45.          # Comet/long-poll stuff. It's also safe to set if you're
  46.          # using only serving fast clients with Unicorn + nginx.
  47.          # Otherwise you _want_ nginx to buffer responses to slow
  48.          # clients, really.
  49.          # proxy_buffering off;
  50.  
  51.          # proxy_pass http://127.0.0.1:8000/;
  52.  
  53.          # Try to serve static files from nginx, no point in making an
  54.          # *application* server like Unicorn/Rainbows! serve static files.
  55.          if (!-f $request_filename) {
  56.              proxy_pass http://hello_app_server;
  57.              break;
  58.          }
  59. }
  60.  
  61. # Error pages
  62. error_page 500 502 503 504 /500.html;
  63. location = /500.html {
  64.      root /webapps/hello_django/static/;
  65.      }
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement