my.conf 813 B

1234567891011121314151617181920212223242526
  1. server {
  2. listen 8080;
  3. server_name localhost;
  4. #charset koi8-r;
  5. #access_log logs/host.access.log main;
  6. location / {
  7. root /usr/share/nginx/html;
  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://177.7.0.12:8888; # 设置代理服务器的协议和地址
  18. }
  19. location /api/swagger/index.html {
  20. proxy_pass http://127.0.0.1:8888/swagger/index.html;
  21. }
  22. }