server { listen 80; server_name qipai-manage.*; charset utf-8; add_header Access-Control-Allow-Origin *; add_header Access-Control-Allow-Headers *; add_header Access-Control-Allow-Methods GET,POST,OPTIONS; if ($request_method = 'OPTIONS') { return 204; } proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Remote_addr $remote_addr; proxy_set_header X-Real_IP $remote_addr; proxy_set_header Host $host; proxy_set_header X-CROS true; # 自定义,有做跨域的时候需要加,后端会做判断 proxy_redirect off; proxy_http_version 1.1; location / { root /usr/share/nginx/html/; try_files $uri $uri/ /index.html; index index.html; } location ^~ /qipai_manager_api/ { proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; # rewrite ^/qipai_manager_api/(.*)$ /$1 break; #重写 proxy_pass http://qipai-manage-server-svc:8888/; } location ^~ /static/uploads/file { alias /home/wwwroot/cos/qipai_manager/uploads/file/; } location ^~ /static { #rewrite ^/static/(.*)$ /$1 break; #重写 #proxy_pass http://cloudimg-xypp.xinyuepp.cn/; rewrite (.+) http://cloudimg-xypp.xinyuepp.cn/ permanent; } location ^~ /assets/images { alias /data/images/; } }