The following matching rules, my purpose is
Static images starting with /api/img are reverse proxy to http://localhost:8084/, such as /api/img/default.png is proxy to http://localhost:8084/default. ..
Static images starting with /api/img/cdn/, reverse proxy to http://clouddn.com/ on cdn, such as /api/img/cdn/default.png proxy to http:/ /clouddn.com/default.png
The first one can be implemented, but the second one cannot be implemented. Thank you for your help in modifying it
server {
listen 8085;
server_name localhost;
location /api/v1 {
proxy_pass http://localhost:8084/api/v1;
}
location ^~ /api/img/cdn/ {
proxy_pass http://clouddn.com/;
}
location /api/img {
proxy_pass http://localhost:8084/;
}
location / {
root html/vue2;
index index.html index.htm;
}
}
我想大声告诉你2017-05-16 17:10:49
Change ^~ /api/img/cdn/ to /api/img/cdn/, or ~ /api/img/cdn/, take a look at the location matching rules, refer to http://seanlook.com/2015/05 /1...
淡淡烟草味2017-05-16 17:10:49
Pay attention to the slashes in your path. If there are no subdirectories, remove the slashes