server {
listen 80;
server_name localhost;
# 原来的配置,匹配根路径
location / {
root /usr/share/nginx/html;
index index.html index.htm;
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS';
add_header Access-Control-Allow-Headers 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
}
# 更该配置,匹配/路径,修改index.html的名字,用于区分该配置文件替换了容器中的配置文件
location /api {
proxy_pass http://ip:8069/;
}
location /change/ {
proxy_pass http://ip:3040/;
}
location /gongcheng/ {
proxy_pass http://ip:8080/;
}
}
一下是转发失败信息
以上是Nginx的转发配置文件及转发失败的截图,希望各位解答一下