production.conf 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. upstream huginn_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. # for UNIX domain socket setups:
  6. server unix:/home/you/app/shared/pids/unicorn.socket;
  7. }
  8. server {
  9. listen 80;
  10. server_name your-domain.com;
  11. rewrite ^(.*) https://www.your-domain.com$1 permanent;
  12. }
  13. server {
  14. listen 80;
  15. server_name www.your-domain.com;
  16. rewrite ^(.*) https://www.your-domain.com$1 permanent;
  17. }
  18. server {
  19. listen 443;
  20. server_name your-domain.com;
  21. ssl on;
  22. ssl_certificate /etc/nginx/ssl-certs/your-domain.com.crt;
  23. ssl_certificate_key /etc/nginx/ssl-certs/your-domain.com.key.nopass;
  24. rewrite ^(.*) https://www.your-domain.com$1 permanent;
  25. }
  26. server {
  27. listen 443;
  28. ssl on;
  29. ssl_certificate /etc/nginx/ssl-certs/your-domain.com.crt;
  30. ssl_certificate_key /etc/nginx/ssl-certs/your-domain.com.key.nopass;
  31. client_max_body_size 4G;
  32. server_name www.your-domain.com;
  33. keepalive_timeout 5;
  34. # path for static files
  35. root /home/you/app/current/public;
  36. try_files $uri/index.html $uri.html $uri @app;
  37. # Rails error pages
  38. error_page 500 502 503 504 /500.html;
  39. location = /500.html {
  40. root /home/you/app/current/public;
  41. }
  42. location @app {
  43. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  44. proxy_set_header X-Forwarded-Proto $scheme;
  45. proxy_set_header Host $http_host;
  46. proxy_redirect off;
  47. proxy_pass http://huginn_app_server;
  48. }
  49. }