使用 nginx 代理将 Apache 连接到 docker

使用 nginx 代理将 Apache 连接到 docker

假设我有一台服务器(Centos 7),其中 Apache 是主要的 80 端口监听器。80 端口上有一些由这个 Apache 驱动的网站。此外,我还在 docker 容器中构建了项目,其中一个容器监听器是 nginx。是否可以通过我的 Apache 守护进程将所有请求代理到 docker 的 nginx,同时其他网站将启动?

答案1

已修复。简单:安装 mod_proxy 并在 Apache domain.conf 文件中将 VirtualHost 块指令添加到以下位置:ProxyPass /http://127.0.0.1:8080/

其中 / 是您要代理的路径,127.0.0.1:8080 是带有 nginx 的 docker 容器的本地 IP 和端口

相关内容