You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

nginx.conf 4.4 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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 20480m;
  11. error_log /var/log/nginx/error.log debug;
  12. server {
  13. listen 8000;
  14. server_name localhost;
  15. location /api/{
  16. # rewrite ^/prod-api/(.*)$ /$1 break;
  17. proxy_set_header Host $http_host;
  18. proxy_set_header X-Real-IP $remote_addr;
  19. proxy_set_header REMOTE-HOST $remote_addr;
  20. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  21. proxy_pass http://ci4s-gateway-service.argo.svc:8082/;
  22. proxy_connect_timeout 500s; # 设置连接超时时间为 120 秒
  23. proxy_read_timeout 500s; # 设置读取超时时间为 120 秒
  24. proxy_send_timeout 500s; # 设置发送超时时间为 120 秒
  25. }
  26. location /label-studio/ {
  27. # rewrite ^/label-studio/(.*)$ /$1 break;
  28. proxy_pass http://label-studio-service.argo.svc:8080/projects/;
  29. proxy_hide_header X-Frame-Options;
  30. add_header X-Frame-Options ALLOWALL;
  31. }
  32. location / {
  33. rewrite ^/prod-api/(.*)$ /$1 break;
  34. root /home/ruoyi/projects/ruoyi-ui;
  35. try_files $uri $uri/ /index.html;
  36. index index.html index.htm;
  37. }
  38. location /api/v1/model/ {
  39. proxy_pass http://pipeline-convert-service.argo.svc:80;
  40. proxy_set_header REMOTE-HOST $remote_addr;
  41. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  42. }
  43. # location /api/v1/realtimeStatus {
  44. # proxy_pass http://argo-server.argo.svc:2746/api/v1/workflow-events/argo;
  45. # proxy_set_header REMOTE-HOST $remote_addr;
  46. # proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  47. # }
  48. location /api/v1/tensorboard/show {
  49. # 提取查询参数中的 `svc` 值
  50. set $svc "";
  51. if ($arg_svc) {
  52. set $svc $arg_svc;
  53. }
  54. # 将请求转发到动态生成的内部服务地址
  55. proxy_pass http://$svc.argo.svc:6006;
  56. # 传递必要的头信息
  57. proxy_set_header Host $host;
  58. proxy_set_header X-Real-IP $remote_addr;
  59. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  60. proxy_set_header X-Forwarded-Proto $scheme;
  61. # 对于 WebSocket 应用很重要
  62. proxy_buffering off;
  63. }
  64. location /api/v1/realtimeStatus {
  65. rewrite ^/api/v1/realtimeStatus(.*)$ /api/v1/workflow-events/argo$1 break;
  66. proxy_pass https://argo-server.argo.svc:2746;
  67. proxy_http_version 1.1;
  68. proxy_set_header Host $host;
  69. proxy_set_header REMOTE-HOST $remote_addr;
  70. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  71. proxy_set_header X-Forwarded-Proto $scheme;
  72. # 保留查询参数
  73. proxy_set_header X-Original-URI $request_uri;
  74. # 禁用缓冲
  75. proxy_buffering off;
  76. # 增加超时时间
  77. proxy_read_timeout 3600s;
  78. proxy_send_timeout 3600s;
  79. proxy_connect_timeout 60s;
  80. # 设置传递的请求头
  81. # proxy_set_header Connection '';
  82. # chunked_transfer_encoding off;
  83. # 如果需要保留自定义头部
  84. proxy_set_header Accept 'text/event-stream';
  85. }
  86. location /newlog/realtimeLog {
  87. proxy_pass http://loki.loki-log.svc:3100/loki/api/v1/tail;
  88. proxy_http_version 1.1;
  89. proxy_set_header Upgrade $http_upgrade;
  90. proxy_set_header Connection "Upgrade";
  91. proxy_set_header Host $host;
  92. proxy_set_header X-Real-IP $remote_addr;
  93. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  94. proxy_set_header X-Forwarded-Proto $scheme;
  95. }
  96. location @router {
  97. rewrite ^.*$ /index.html last;
  98. }
  99. # 避免actuator暴露
  100. if ($request_uri ~ "/actuator") {
  101. return 403;
  102. }
  103. error_page 500 502 503 504 /50x.html;
  104. location = /50x.html {
  105. root html;
  106. }
  107. }
  108. }