nginx.conf 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. server {
  2. listen 80;
  3. server_name localhost;
  4. #charset koi8-r;
  5. #access_log logs/host.access.log main;
  6. location / {
  7. root /usr/share/nginx/html/dist;
  8. add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
  9. try_files $uri $uri/ /index.html;
  10. }
  11. location /api {
  12. proxy_set_header Host $http_host;
  13. proxy_set_header X-Real-IP $remote_addr;
  14. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  15. proxy_set_header X-Forwarded-Proto $scheme;
  16. rewrite ^/api/(.*)$ /$1 break; #重写
  17. proxy_pass http://127.0.0.1:8888; # 设置代理服务器的协议和地址
  18. }
  19. location /form-generator {
  20. proxy_set_header Host $http_host;
  21. proxy_set_header X-Real-IP $remote_addr;
  22. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  23. proxy_set_header X-Forwarded-Proto $scheme;
  24. proxy_pass http://127.0.0.1:8888;
  25. }
  26. location /api/swagger/index.html {
  27. proxy_pass http://127.0.0.1:8888/swagger/index.html;
  28. }
  29. }