resinfotd 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. upstream resinfotd_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. server unix:/sites/resinfotd/run/gunicorn.sock fail_timeout=0;
  6. }
  7. server {
  8. listen 80;
  9. server_name resinfotd.ici.ro;
  10. client_max_body_size 1G;
  11. access_log /sites/resinfotd/logs/access.log;
  12. error_log /sites/resinfotd/logs/error.log;
  13. location /static/ {
  14. alias /sites/resinfotd/resinfotd/website/static/;
  15. }
  16. location /media/ {
  17. alias /sites/resinfotd/resinfotd/website/media/;
  18. }
  19. location / {
  20. # an HTTP header important enough to have its own Wikipedia entry:
  21. # http://en.wikipedia.org/wiki/X-Forwarded-For
  22. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  23. # enable this if and only if you use HTTPS, this helps Rack
  24. # set the proper protocol for doing redirects:
  25. # proxy_set_header X-Forwarded-Proto https;
  26. # pass the Host: header from the client right along so redirects
  27. # can be set properly within the Rack application
  28. proxy_set_header Host $http_host;
  29. # we don't want nginx trying to do something clever with
  30. # redirects, we set the Host: header above already.
  31. proxy_redirect off;
  32. # set "proxy_buffering off" *only* for Rainbows! when doing
  33. # Comet/long-poll stuff. It's also safe to set if you're
  34. # using only serving fast clients with Unicorn + nginx.
  35. # Otherwise you _want_ nginx to buffer responses to slow
  36. # clients, really.
  37. # proxy_buffering off;
  38. # Try to serve static files from nginx, no point in making an
  39. # *application* server like Unicorn/Rainbows! serve static files.
  40. if (!-f $request_filename) {
  41. proxy_pass http://resinfotd_app_server;
  42. break;
  43. }
  44. }
  45. }