Apache as a proxy for Nexus, Jenkins and Foreman (Several VirtualHosts on same domain, IP and Port)
I'd like to configure Apache to be used as a proxy for Nexus, Jenkins and Foreman which are installed and running on the same server.
Here is an example of the Virtual host config file for Foreman, the others files for Nexus and Jenkins looks pretty the same except the proxy pass parameters.
LoadModule ssl_module modules/mod_ssl.so
NameVirtualHost *:443
<VirtualHost *:443>
SSLEngine On
SSLProxyEngine On
SSLCertificateFile /etc/httpd/ssl/certs/ssl.crt
SSLCertificateKeyFile /etc/httpd/ssl/keys/server.key
ServerName management.domain.com
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass /foreman http://127.0.0.1:3000/foreman
ProxyPassReverse /foreman http://127.0.0.1:3000/foreman
ProxyPassReverse /foreman http://management.domain.com/foreman
ProxyRequests Off
ProxyPreserveHost On
ErrorLog /var/log/httpd/management.domain.com_foreman_error.log
LogLevel warn
CustomLog /var/log/httpd/management.domain.com_foreman_access.log combined
</VirtualHost>
The problem is that Apache takes in account only one config file and ignores the two others which leads to the error message "The requested URL /jenkins/ was not found on this server." when I try to access the URL management.domain.com/jenkins
How to configure Apache to load the three virtual hosts ? Thanks
PS: the Listen directive is declared in httpd.conf (= 443)
If you use one servername it wouldn't work as you want. All you need is to merge 3 virt host in to the one. Something like
LoadModule ssl_module modules/mod_ssl.so
NameVirtualHost *:443
<VirtualHost *:443>
SSLEngine On
SSLProxyEngine On
SSLCertificateFile /etc/httpd/ssl/certs/ssl.crt
SSLCertificateKeyFile /etc/httpd/ssl/keys/server.key
ProxyRequests Off
ProxyPreserveHost On
ServerName management.domain.com
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass /foreman http://127.0.0.1:3000/foreman
ProxyPassReverse /foreman http://127.0.0.1:3000/foreman
ProxyPassReverse /foreman http://management.domain.com/foreman
ProxyPass /nexus http://127.0.0.1:3000/nexus
ProxyPassReverse /nexus http://127.0.0.1:3000/nexus
ProxyPassReverse /nexus http://management.domain.com/nexus
ProxyPass /jenkins http://127.0.0.1:3000/jenkins
ProxyPassReverse /jenkins http://127.0.0.1:3000/jenkins
ProxyPassReverse /jenkins http://management.domain.com/jenkins