nginx.example.conf 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. # TARGET-voc-instance 反向代理示例
  2. # 浏览器只访问客户域名;公司中转由后端出站 HTTPS 访问。
  3. server {
  4. listen 443 ssl http2;
  5. server_name TARGET_HOST;
  6. # ssl_certificate /path/to/fullchain.pem;
  7. # ssl_certificate_key /path/to/privkey.pem;
  8. root /var/www/TARGET-voc-instance/frontend/dist;
  9. index index.html;
  10. location / {
  11. try_files $uri $uri/ /index.html;
  12. }
  13. location /api/ {
  14. proxy_pass http://127.0.0.1:3000/api/;
  15. proxy_http_version 1.1;
  16. proxy_set_header Host $host;
  17. proxy_set_header X-Real-IP $remote_addr;
  18. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  19. proxy_set_header X-Forwarded-Proto $scheme;
  20. proxy_set_header X-Request-Id $request_id;
  21. proxy_read_timeout 60s;
  22. }
  23. location /parse/ {
  24. proxy_pass http://127.0.0.1:3000/parse/;
  25. proxy_http_version 1.1;
  26. proxy_set_header Host $host;
  27. proxy_set_header X-Real-IP $remote_addr;
  28. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  29. proxy_set_header X-Forwarded-Proto $scheme;
  30. }
  31. location = /health {
  32. proxy_pass http://127.0.0.1:3000/health;
  33. }
  34. }