1

Let me start by saying i'm new to Apache2.

I'm trying to configure Apache2 as a Reverse Proxy for 2 Docker containers (Gitlab and a email service). My configuration is as follows:

<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>

and

<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

I have edited the /etc/hosts file.

The config files are set up exactly the same (except for name and IP address) but for some reason regardless of which link i follow (www.gitlab.ch or wwww.email.ch) , i always end up at the email login panel so i guess apache gives priority to that.

The port configuration is as follows (Host Machine:Container)

Gitlab:

8800:80
4433:443

Email:

2500:25 
8000:80 
4430:443 
1100:110 
1430:143 
4650:465 
5870:587 
9930:993 
9950:995

Any help is much appreciated.

0

1 Answer 1

1

EDIT: Found out how to fix it, just had to edit /etc/hosts file

Original:

127.0.0.1    www.gitlab.ch
127.0.0.1    www.email.ch

Fixed:

172.17.0.2    www.gitlab.ch
172.17.0.3    www.email.ch

The problem was that i used the host machines local IP insted of the Docker Conatiners IP.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .