Advertisement
Guest User

Untitled

a guest
Aug 2nd, 2015
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. upstream web_rack {
  2. server 1.1.1.1:80;
  3. server 2.2.2.2:80;
  4. }
  5. server {
  6. listen 80;
  7. listen [::]:80;
  8. server_name domain.com;
  9. client_max_body_size 1G;
  10. # the server will close connections after this time
  11. keepalive_timeout 5;
  12. location / {
  13. proxy_set_header Host $host;
  14. proxy_set_header X-Real-IP $remote_addr;
  15. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  16. proxy_set_header X-Forwarded-Proto https;
  17. proxy_pass http://web_rack;
  18. }
  19. }
  20.  
  21. upstream domain.com {
  22. server unix:/tmp/unicorn.theapp.socket
  23. fail_timeout=0;
  24. }
  25. server {
  26. listen 80;
  27. server_name domain.com;
  28.  
  29. # replace this with your static Sinatra app files, root + public
  30. root /home/app/mainapp/current/public;
  31. # port to listen for requests on
  32. error_log /var/log/nginx-error.log;
  33. # maximum accepted body size of client request
  34. client_max_body_size 1G;
  35. # the server will close connections after this time
  36. keepalive_timeout 5;
  37. location ~ ^(js|images|css|fonts|views|assets)$ {
  38. root /home/app/mainapp/current/public;
  39. expires max;
  40. add_header Cache-Control public;
  41. log_not_found off;
  42. }
  43. location / {
  44. try_files $uri @app;
  45. }
  46.  
  47. location @app {
  48. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  49. proxy_set_header Host $http_host;
  50. proxy_redirect off;
  51. # pass to the upstream unicorn server mentioned above
  52. proxy_pass http://domain.com;
  53. }
  54.  
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement