nginx.conf 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. worker_processes 1;
  2. events {
  3. worker_connections 1024;
  4. }
  5. http {
  6. include mime.types;
  7. default_type application/octet-stream;
  8. sendfile on;
  9. keepalive_timeout 65;
  10. client_max_body_size 1024m;
  11. map $http_upgrade $connection_upgrade {
  12. default upgrade;
  13. '' close;
  14. }
  15. server {
  16. listen 80;
  17. server_name localhost;
  18. location / {
  19. root /home/vctgo/projects/vctgo-ui;
  20. try_files $uri $uri/ /index.html;
  21. index index.html index.htm;
  22. }
  23. # 平台端前端文件
  24. location /platform {
  25. root /home/vctgo/projects;
  26. try_files $uri $uri/ /platform/index.html;
  27. index index.html index.htm;
  28. }
  29. # 幼儿园端前端文件
  30. location /kindergarten {
  31. root /home/vctgo/projects;
  32. try_files $uri $uri/ /kindergarten/index.html;
  33. index index.html index.htm;
  34. }
  35. location /prod-api/ {
  36. proxy_set_header Host $http_host;
  37. proxy_set_header X-Real-IP $remote_addr;
  38. proxy_set_header REMOTE-HOST $remote_addr;
  39. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  40. proxy_pass http://vctgo-gateway:38080/;
  41. }
  42. # 第一个.*服务名称与网关配置一致,第二个.*是具体的业务
  43. location ~ /prod-api/(.*)/websocket/(.*) {
  44. proxy_set_header Upgrade $http_upgrade;
  45. proxy_set_header Connection $connection_upgrade;
  46. proxy_pass http://vctgo-gateway:38080/$1/websocket/$2?$query_string;
  47. }
  48. # 避免actuator暴露
  49. if ($request_uri ~ "/actuator") {
  50. return 403;
  51. }
  52. error_page 500 502 503 504 /50x.html;
  53. location = /50x.html {
  54. root html;
  55. }
  56. }
  57. }