site.conf 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. map $http_upgrade $connection_upgrade {
  2. default upgrade;
  3. '' close;
  4. }
  5. upstream swoole {
  6. # Connect IP:Port, php is the name of php container
  7. server php:5200 weight=5 max_fails=3 fail_timeout=30s;
  8. keepalive 16;
  9. }
  10. server {
  11. listen 80;
  12. include /var/www/docker/site/*.conf;
  13. # Don't forget to bind the host
  14. server_name wookteam.com;
  15. root /var/www/public;
  16. client_max_body_size 200m;
  17. autoindex off;
  18. index index.html index.htm index.php;
  19. charset utf-8;
  20. location / {
  21. try_files $uri @laravels;
  22. }
  23. location =/ws {
  24. proxy_http_version 1.1;
  25. proxy_set_header X-Real-IP $remote_addr;
  26. proxy_set_header X-Real-PORT $remote_port;
  27. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  28. proxy_set_header Host $http_host;
  29. proxy_set_header Scheme $scheme;
  30. proxy_set_header Server-Protocol $server_protocol;
  31. proxy_set_header Server-Name $server_name;
  32. proxy_set_header Server-Addr $server_addr;
  33. proxy_set_header Server-Port $server_port;
  34. proxy_set_header Upgrade $http_upgrade;
  35. proxy_set_header Connection $connection_upgrade;
  36. # "swoole" is the upstream
  37. proxy_pass http://swoole;
  38. }
  39. location @laravels {
  40. proxy_http_version 1.1;
  41. proxy_set_header Connection "";
  42. proxy_set_header X-Real-IP $remote_addr;
  43. proxy_set_header X-Real-PORT $remote_port;
  44. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  45. proxy_set_header Host $http_host;
  46. proxy_set_header Scheme $scheme;
  47. proxy_set_header Server-Protocol $server_protocol;
  48. proxy_set_header Server-Name $server_name;
  49. proxy_set_header Server-Addr $server_addr;
  50. proxy_set_header Server-Port $server_port;
  51. # "swoole" is the upstream
  52. proxy_pass http://swoole;
  53. }
  54. }