nginx-local.conf 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. client_max_body_size 8M;
  33. location / {
  34. try_files $uri @rails;
  35. }
  36. # Proxy connections to rails
  37. location @rails {
  38. proxy_set_header Host $host;
  39. proxy_pass_header Server;
  40. proxy_pass http://rails;
  41. proxy_buffering off;
  42. proxy_redirect off;
  43. proxy_http_version 1.1;
  44. proxy_set_header Upgrade $http_upgrade;
  45. proxy_set_header Connection $connection_upgrade;
  46. tcp_nodelay on;
  47. }
  48. # Proxy connections to node
  49. location /api/v1/streaming {
  50. proxy_set_header Host $host;
  51. proxy_pass http://node;
  52. proxy_buffering off;
  53. proxy_redirect off;
  54. proxy_http_version 1.1;
  55. proxy_set_header Upgrade $http_upgrade;
  56. proxy_set_header Connection $connection_upgrade;
  57. tcp_nodelay on;
  58. }
  59. }
  60. error_page 500 501 502 503 504 /500.html;
  61. }