nginx-local.conf 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. worker_processes 1;
  2. daemon off;
  3. events {
  4. worker_connections 1024;
  5. }
  6. http {
  7. include /data/etc/nginx/mime.types;
  8. sendfile on;
  9. gzip on;
  10. gzip_disable "MSIE [1-6]\.";
  11. gzip_vary on;
  12. gzip_proxied any;
  13. gzip_comp_level 6;
  14. gzip_buffers 16 8k;
  15. gzip_min_length 500;
  16. gzip_http_version 1.1;
  17. gzip_types text/plain text/xml text/javascript text/css text/comma-separated-values application/xml+rss application/xml application/x-javascript application/json application/javascript application/atom+xml;
  18. # Proxy upstream to the puma process
  19. upstream rails {
  20. server 127.0.0.1:3000;
  21. }
  22. # Proxy upstream to the node process
  23. upstream node {
  24. server 127.0.0.1:4000;
  25. }
  26. map $http_upgrade $connection_upgrade {
  27. default upgrade;
  28. '' close;
  29. }
  30. # Configuration for Nginx
  31. server {
  32. # Listen on port 8080
  33. listen 8080;
  34. keepalive_timeout 70;
  35. client_max_body_size 80M;
  36. root /app/public;
  37. add_header Strict-Transport-Security "max-age=31536000";
  38. location / {
  39. try_files $uri @rails;
  40. }
  41. # Proxy connections to rails
  42. location @rails {
  43. proxy_set_header Host $host;
  44. proxy_set_header X-Real-IP $remote_addr;
  45. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  46. proxy_set_header X-Forwarded-Proto https;
  47. proxy_set_header Proxy "";
  48. proxy_pass_header Server;
  49. proxy_pass http://rails;
  50. proxy_buffering off;
  51. proxy_redirect off;
  52. proxy_http_version 1.1;
  53. proxy_set_header Upgrade $http_upgrade;
  54. proxy_set_header Connection $connection_upgrade;
  55. tcp_nodelay on;
  56. }
  57. # Proxy connections to node
  58. location /api/v1/streaming {
  59. proxy_set_header Host $host;
  60. proxy_set_header X-Real-IP $remote_addr;
  61. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  62. proxy_set_header X-Forwarded-Proto https;
  63. proxy_set_header Proxy "";
  64. proxy_pass http://node;
  65. proxy_buffering off;
  66. proxy_redirect off;
  67. proxy_http_version 1.1;
  68. proxy_set_header Upgrade $http_upgrade;
  69. proxy_set_header Connection $connection_upgrade;
  70. tcp_nodelay on;
  71. }
  72. }
  73. error_page 500 501 502 503 504 /500.html;
  74. }