nginx reverse proxy exclude directory
怪我咯
怪我咯 2017-05-16 17:10:06
0
1
821

The two servers A and B use nginx reverse proxy to balance the load

A server's website abc.com is reverse-proxyed to Server B. The content of abc.com is provided by Server B. Domain name resolution and telecommunications lines are resolved to Server B, which is the origin site, and other lines are resolved to Server A.

Considering that server A still has remaining resources, transfer some of the static resources of server B to server A, and create a new folder file. That is, when accessing server abc.com/file of server A, the content will no longer be provided by server B, but by server B. Directly read the local content of server A. Because the entire site has been used as a reverse proxy before, so when testing server A abc.com/file/xxx.jpg, etc., it still reads the content of server B. If it does not, it will still report an error 404.

Solution: How to exclude the local file directory of server A when using reverse proxy?

怪我咯
怪我咯

走同样的路,发现不同的人生

reply all(1)
伊谢尔伦
server {
    server_name abc.com;
    
    location /file {
        root /path/to/file/on/ServerA;
    }
    
    location / {
        proxy_pass http://ServerB;
    }
}
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!