site.conf 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. autoindex off;
  17. index index.html index.htm index.php;
  18. charset utf-8;
  19. location / {
  20. try_files $uri @laravels;
  21. }
  22. location =/ws {
  23. proxy_http_version 1.1;
  24. proxy_set_header X-Real-IP $remote_addr;
  25. proxy_set_header X-Real-PORT $remote_port;
  26. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  27. proxy_set_header Host $http_host;
  28. proxy_set_header Scheme $scheme;
  29. proxy_set_header Server-Protocol $server_protocol;
  30. proxy_set_header Server-Name $server_name;
  31. proxy_set_header Server-Addr $server_addr;
  32. proxy_set_header Server-Port $server_port;
  33. proxy_set_header Upgrade $http_upgrade;
  34. proxy_set_header Connection $connection_upgrade;
  35. # "swoole" is the upstream
  36. proxy_pass http://swoole;
  37. }
  38. location @laravels {
  39. proxy_http_version 1.1;
  40. proxy_set_header Connection "";
  41. proxy_set_header X-Real-IP $remote_addr;
  42. proxy_set_header X-Real-PORT $remote_port;
  43. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  44. proxy_set_header Host $http_host;
  45. proxy_set_header Scheme $scheme;
  46. proxy_set_header Server-Protocol $server_protocol;
  47. proxy_set_header Server-Name $server_name;
  48. proxy_set_header Server-Addr $server_addr;
  49. proxy_set_header Server-Port $server_port;
  50. # "swoole" is the upstream
  51. proxy_pass http://swoole;
  52. }
  53. }