nginx proxy_pass和页面中的URL

问题描述 投票:0回答:1

我在nginx中的proxy_pass有问题。我只有一页,例如test.com。在test.com/article中,我使用proxy_pass:

server {
    listen         80;
    server_name    test.pl;
    root           /var/www/html/test.com;
    index          index.html;
    try_files $uri /index.html;

        location /article/ {
                proxy_pass https://anotherpage.com/;
        }

}

并且它起作用了,但是如果我在test.com/article页面中有链接,它们看起来就像:test.com/some-link

我希望它是:test.com/article/some-link

任何想法或技巧,我该怎么做?

nginx proxypass
1个回答
0
投票

删除斜杠:

location /article {
     proxy_pass https://anotherpage.com;
}
最新问题
© www.soinside.com 2019 - 2025. All rights reserved.