Nginx 实现多链接域名转发
比如 有如下连接 https://v.abc.com/stage/v5/6RHJ4/601125472 https://v.abc.com/stage/v5/2KjGN/601110528
我希望通过nginx域名转发配置 实现
访问 https://www.mydomain.com/stage/v5/6RHJ4/601125472 会对于转发到 https://v.xiumi.us/stage/v5/6RHJ4/601125472
访问 https://www.mydomain.com/stage/v5/2KjGN/601110528 会对于转发到 https://v.xiumi.us/stage/v5/2KjGN/601110528
nginx 配置如下:
server {
    listen 80;  # 如果使用HTTPS,这里改为443,并配置SSL证书
    server_name www.mydomain.com;
    location /stage/v5/6RHJ4/601125472 {
        proxy_pass https://v.abc.com/stage/v5/6RHJ4/601125472;
        proxy_set_header Host $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;
    }
    location /stage/v5/2KjGN/601110528 {
        proxy_pass https://v.abc.com/stage/v5/2KjGN/601110528;
        proxy_set_header Host $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;
    }
}