1
0

nginx-stream.conf.erb 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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 node process
  19. upstream node {
  20. server 127.0.0.1:4000;
  21. }
  22. map $http_upgrade $connection_upgrade {
  23. default upgrade;
  24. '' close;
  25. }
  26. # Configuration for Nginx
  27. server {
  28. # Listen on port 8080
  29. listen 8080;
  30. keepalive_timeout 70;
  31. client_max_body_size 80M;
  32. root /app/public;
  33. add_header Strict-Transport-Security "max-age=31536000";
  34. location / {
  35. try_files $uri @node;
  36. }
  37. # Proxy connections to node
  38. location @node {
  39. proxy_set_header Host $host;
  40. proxy_set_header X-Real-IP $remote_addr;
  41. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  42. proxy_set_header X-Forwarded-Proto https;
  43. proxy_set_header Proxy "";
  44. proxy_pass http://node;
  45. proxy_buffering off;
  46. proxy_redirect off;
  47. proxy_http_version 1.1;
  48. proxy_set_header Upgrade $http_upgrade;
  49. proxy_set_header Connection $connection_upgrade;
  50. tcp_nodelay on;
  51. }
  52. }
  53. }