Advertisement
Guest User

trying multiple server blocks on nginx

a guest
Apr 29th, 2013
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. upstream app_server {
  2. # for UNIX domain socket setups:
  3. server unix:/tmp/.sock fail_timeout=0;
  4.  
  5. # for TCP setups, point these to your backend servers
  6. # server 127.0.0.1:8080 fail_timeout=0;
  7. # server 192.168.0.8:8080 fail_timeout=0;
  8. # server 192.168.0.9:8080 fail_timeout=0;
  9. }
  10.  
  11. server {
  12. listen 80;
  13. server_name www.mydomain.it mydomain.it;
  14. location / {
  15. proxy_pass http://app_server/it;
  16. }
  17. }
  18.  
  19. server {
  20. listen 80 default deferred;
  21.  
  22. client_max_body_size 4G;
  23. server_name _;
  24.  
  25. keepalive_timeout 5;
  26.  
  27. # path for static files
  28. root /home/app_user/current/my_app/public/;
  29.  
  30. # Prefer to serve static files directly from nginx to avoid unnecessary
  31. try_files $uri/index.html $uri.html $uri @app;
  32.  
  33. location @app {
  34. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  35.  
  36. proxy_set_header Host $http_host;
  37.  
  38. proxy_redirect off;
  39.  
  40. proxy_pass http://app_server;
  41. }
  42.  
  43. # Rails error pages
  44. error_page 500 502 503 504 /500.html;
  45. location = /500.html {
  46. root /path/to/app/current/public;
  47. }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement