default.conf 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. map $http_upgrade $connection_upgrade {
  2. default upgrade;
  3. '' close;
  4. }
  5. upstream oct {
  6. server application:9000;
  7. }
  8. server {
  9. listen 80;
  10. listen [::]:80;
  11. index index.php;
  12. server_name _;
  13. server_tokens off;
  14. root /app/public;
  15. charset utf-8;
  16. location /index.php {
  17. try_files /not_exists @octane;
  18. }
  19. location /health {
  20. add_header Content-Type text/plain;
  21. return 200 'alive';
  22. }
  23. location /rr-metrics {
  24. proxy_pass http://application:9180;
  25. proxy_set_header Host $host;
  26. proxy_set_header X-Forwarded-For $remote_addr;
  27. proxy_set_header X-Forwarded-Port $server_port;
  28. proxy_set_header X-Forwarded-Host $host;
  29. proxy_set_header X-Forwarded-Proto $scheme;
  30. proxy_read_timeout 1200s;
  31. }
  32. location /app {
  33. # WebSocket support
  34. proxy_pass http://reverb:8080;
  35. proxy_http_version 1.1;
  36. # WebSocket headers
  37. proxy_set_header Upgrade $http_upgrade;
  38. proxy_set_header Connection "upgrade";
  39. # Standard headers
  40. proxy_set_header Host $http_host;
  41. proxy_set_header Scheme $http_x_forwarded_proto;
  42. proxy_set_header X-Real-IP $http_x_real_ip;
  43. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  44. proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;
  45. # WebSocket timeouts
  46. proxy_read_timeout 86400;
  47. proxy_send_timeout 86400;
  48. proxy_connect_timeout 60;
  49. # Disable buffering for WebSocket
  50. proxy_buffering off;
  51. proxy_cache off;
  52. }
  53. location / {
  54. try_files $uri $uri/ @octane;
  55. }
  56. location = /favicon.ico { access_log off; log_not_found off; }
  57. location = /robots.txt { access_log off; log_not_found off; }
  58. access_log off;
  59. error_log /var/log/nginx/default.error.log error;
  60. error_page 404 /index.php;
  61. location @octane {
  62. set $suffix "";
  63. if ($uri = /index.php) {
  64. set $suffix ?$query_string;
  65. }
  66. proxy_http_version 1.1;
  67. proxy_set_header Host $http_host;
  68. proxy_set_header Scheme $http_x_forwarded_proto;
  69. proxy_set_header X-Real-IP $http_x_real_ip;
  70. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  71. proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;
  72. proxy_pass http://oct$suffix;
  73. }
  74. }