proxy - nginx 将所有流量代理到远程 nginx

标签 proxy nginx traffic

我有 2 台服务器,

  1. IP xx.xx.xx.xx,位于德国...(运行前端:nginx(静态内容),后端:Apache2)

  2. 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/

相关文章:

服务器进程上的valgrind

seo - 如何通过关键字规划器或 Adword API 查找大量关键字(比如 100 万)的搜索量

azure - 如何在 Kubernetes (AKS) 中使用 Helm 注释 Ingress Controller 的 Pod?

node.js - 如何通过 Node http-proxy记录websocket流量数据

javascript - React函数参数是Proxy?

java - 运行 "web proxy"进行集成测试的 Maven 插件

git - Julia 1.6 : can't git clone using proxy (but git alone can) on Windows

proxy - VPN服务器如何将所有通过的HTTPS请求重定向到固定接口(interface)

google-chrome - Nginx 在长 URL 上返回空响应 - (失败)net::ERR_EMPTY_RESPONSE

windows - ffmpeg 到 Windows 上的 nginx rtmp 出现 I/O 错误