我有 2 台服务器,
IP xx.xx.xx.xx,位于德国...(运行前端:nginx(静态内容),后端:Apache2)
IP yy.yy.yy.yy,位于意大利...
目前所有请求都发送到 IP xx.xx.xx.xx 的服务器, 如何使用 nginx 代理从 xx.xx.xx.xx 到 yy.yy.yy.yy 的所有流量...
request proxy, request
Internet -> xx.xx.xx.xx(nginx) -> yy.yy.yy.yy(nginx, Apache)
<- <-
response proxy, response
最佳答案
对于其他人。主题的答案是配置 Nginx,如下所示:
server {
listen 80;
server_name mydomain.example;
location / {
access_log off;
proxy_pass http://mydomain.example:8080;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
关于proxy - nginx 将所有流量代理到远程 nginx,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5432331/