在 Apache 后面设置 Artifactory 和 Jenkins

在 Apache 后面设置 Artifactory 和 Jenkins

我目前可以通过以下方式访问 Artifactory http://localhost:8081/artifactory,可以通过以下方式访问 Jenkinshttp://localhost:8080/jenkins/

我希望 Jenkins 和 Artfactory 可以通过以下方式访问

http://localhost/jenkins
http://localhost/artifactory 

分别。

目前,我的配置中的虚拟主机部分如下所示:

NameVirtualHost *:80

<VirtualHost *:80>
    ServerName jenkins
    ProxyRequests     Off
    ProxyPass         /jenkins  http://localhost:8080/jenkins
    ProxyPassReverse  /jenkins  http://localhost:8080/jenkins
    ErrorLog "C:\Program Files (x86)\Apache Group\Apache2\logs\jenkins-error.log"
    CustomLog "C:\Program Files (x86)\Apache Group\Apache2\logs\jenkins-access.log" combined

   <Proxy http://localhost:8080/jenkins*>
      Order allow,deny
      Allow from all
     </Proxy>
    ProxyPreserveHost on
</VirtualHost>


<VirtualHost *:80>
    ServerName artifactory
    ErrorLog "C:\Program Files (x86)\Apache Group\Apache2\logs\artifactory-error.log"
    CustomLog "C:\Program Files (x86)\Apache Group\Apache2\logs\artifactory-access.log" combined
    ProxyPreserveHost on

    ProxyPass /artifactory/ http://localhost:8081/artifactory/
    ProxyPassReverse /artifactory/ http://localhost/artifactory/
</VirtualHost>

如果 Jenkins 是第一个虚拟主机,那么我可以访问它,http://localhost/jenkins但无法访问artifactory http://localhost/artifactory,反之亦然。

我的输出Apache.exe -S是:

VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:80                   is a NameVirtualHost
         default server jenkins (C:/Program Files (x86)/Apache Group/Apache2/conf/httpd.conf:974)
         port 80 namevhost jenkins (C:/Program Files (x86)/Apache Group/Apache2/conf/httpd.conf:974)
         port 80 namevhost artifactory (C:/Program Files (x86)/Apache Group/Apache2/conf/httpd.conf:990)
Syntax OK

我哪里做错了?

答案1

我认为您应该只有一个 VirtualHost 并将两个 ProxyPass 映射放入其中。

相关内容