首先,我要说我是Apache2的新手。
我正在尝试将Apache2配置为2个Docker容器(Gitlab和电子邮件服务)的反向代理。我的配置如下:
<VirtualHost *:80>
ProxyPreserveHost On
# Servers to proxy the connection, or;
# List of application servers:
# Usage:
# ProxyPass / http://[IP Addr.]:[port]/
# ProxyPassReverse / http://[IP Addr.]:[port]/
# Example:
ProxyPass / http://172.17.0.2/
ProxyPassReverse / http://172.17.0.2/
ServerAlias www.gitlab.ch
ServerName www.gitlab.ch
</VirtualHost>
和
<VirtualHost *:443>
ServerAdmin webmaster@localhost
ProxyPreserveHost On
# Servers to proxy the connection, or;
# List of application servers:
# Usage:
# ProxyPass / http://[IP Addr.]:[port]/
# ProxyPassReverse / http://[IP Addr.]:[port]/
# Example:
SSLProxyVerify none
SSLProxyEngine on
SSLProxyCheckPeerCN off
SSLProxyCheckPeerName off
SSLProxyCheckPeerExpire off
ProxyPass / https://172.17.0.2/
ProxyPassReverse / https://172.17.0.2/
ServerAlias www.gitlab.ch
ServerName www.gitlab.ch
我已经编辑了/ etc / hosts文件。
配置文件的设置完全相同(名称和IP地址除外),但是出于某种原因,无论我遵循哪个链接(www.gitlab.ch或wwww.email.ch),我总是以电子邮件登录面板结尾所以我想apache优先考虑这一点。
端口配置如下(主机:容器)
GitLab:
8800:80
4433:443
电子邮件:
2500:25
8000:80
4430:443
1100:110
1430:143
4650:465
5870:587
9930:993
9950:995
任何帮助深表感谢。
编辑:找到了解决方法,只需要编辑/ etc / hosts文件
原来的:
127.0.0.1 www.gitlab.ch
127.0.0.1 www.email.ch
固定的:
172.17.0.2 www.gitlab.ch
172.17.0.3 www.email.ch
问题是我使用了由Docker Conatiners IP插入的主机本地IP。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句