Apache作为Nexus,Jenkins和Foreman的代理(在相同域,IP和端口上的多个VirtualHost)

我想将Apacheconfiguration为在同一台服务器上安装并运行的Nexus,Jenkins和Foreman的代理

这里是Foreman的虚拟主机configuration文件的示例,Nexus和Jenkins的其他文件看起来非常相似,除了代理传递参数。

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> 

问题是,Apache只考虑了一个configuration文件,而忽略了另外两个导致错误信息“请求的URL / jenkins /在这个服务器上找不到的”。 当我尝试访问URL management.domain.com/jenkins

如何configurationApache来加载这三个虚拟主机? 谢谢

PS:Listen指令在httpd.conf(= 443)中声明

如果您使用一个服务器名称,它将无法正常工作。 所有你需要的是将3 virt主机合并到一个。 就像是

 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