nginx-local.conf 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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_http_version 1.0;
  11. gzip_proxied any;
  12. gzip_min_length 500;
  13. gzip_disable "MSIE [1-6]\.";
  14. 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;
  15. # Proxy upstream to the puma process
  16. upstream rails {
  17. server 127.0.0.1:3000;
  18. }
  19. # Proxy upstream to the node process
  20. upstream node {
  21. server 127.0.0.1:4000;
  22. }
  23. map $http_upgrade $connection_upgrade {
  24. default upgrade;
  25. '' close;
  26. }
  27. # Configuration for Nginx
  28. server {
  29. # Listen on port 8080
  30. listen 8080;
  31. root /app/public;
  32. location / {
  33. try_files $uri @rails;
  34. }
  35. # Proxy connections to rails
  36. location @rails {
  37. proxy_set_header Host $host;
  38. proxy_pass_header Server;
  39. proxy_pass http://rails;
  40. proxy_buffering off;
  41. proxy_redirect off;
  42. proxy_http_version 1.1;
  43. proxy_set_header Upgrade $http_upgrade;
  44. proxy_set_header Connection $connection_upgrade;
  45. tcp_nodelay on;
  46. }
  47. # Proxy connections to node
  48. location /api/v1/streaming {
  49. proxy_set_header Host $host;
  50. proxy_pass http://node;
  51. proxy_buffering off;
  52. proxy_redirect off;
  53. proxy_http_version 1.1;
  54. proxy_set_header Upgrade $http_upgrade;
  55. proxy_set_header Connection $connection_upgrade;
  56. tcp_nodelay on;
  57. }
  58. }
  59. error_page 500 501 502 503 504 /500.html;
  60. }