Advertisement
Guest User

Untitled

a guest
Apr 20th, 2014
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.05 KB | None | 0 0
  1. upstream incopro_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:/root/django/run/gunicorn.sock fail_timeout=0;
  7. }
  8.  
  9. server {
  10.  
  11. listen 80;
  12. server_name 146.185.141.46;
  13.  
  14. client_max_body_size 4G;
  15.  
  16. access_log /root/django/logs/nginx-access.log;
  17. error_log /root/django/logs/nginx-error.log;
  18.  
  19. location /static/ {
  20. alias /root/django/static/;
  21. }
  22.  
  23. location /media/ {
  24. alias /root/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. # Try to serve static files from nginx, no point in making an
  52. # *application* server like Unicorn/Rainbows! serve static files.
  53. if (!-f $request_filename) {
  54. proxy_pass http://incopro_app_server;
  55. break;
  56. }
  57. }
  58.  
  59. # Error pages
  60. error_page 500 502 503 504 /500.html;
  61. location = /500.html {
  62. root /root/django/static/;
  63. }
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement