我试图在apache2后面安装jenkins(全新安装包pipe理器)使用的操作系统:ubuntu 12.04 LTS
其实我在这个Apache背后设置了一些服务。 首先是artifactory。 在这里我的网站文件
<VirtualHost *:80> ServerAdmin [email protected] DocumentRoot "/var/www" ServerName aDomain.com ErrorLog "/path/to/artifactoryVirtualHost.log" ProxyRequests off ProxyPass /artifactory http://127.0.0.1:8081/artifactory ProxyPassReverse /artifactory http://127.0.0.1:8081/artifactory ProxyPreserveHost on </VirtualHost>
它是按照预期的工作,当我去aDomain.com/artifactory它redirect到artifactoryembedded式tomcat。
这是我的jenkins网站文件
<VirtualHost *:80> ServerAdmin [email protected] DocumentRoot "/var/www" ServerName aDomain.com ErrorLog "/path/to/jenkinsVirtualHost.log" ProxyRequests off ProxyPass /jenkins ajp://127.0.0.1:8102/jenkins ProxyPassReverse /jenkins ajp://127.0.0.1:8102/jenkins ProxyPreserveHost on </VirtualHost>
注意这里的区别我在这里使用AJP连接器,因为jenkins允许它没有太多的configuration。 另外jenkins在我的/ etc / default / jenkins文件中需要更多的configuration
JENKINS_ARGS="--webroot=$JENKINS_RUN/war --httpPort=$HTTP_PORT --ajp13Port=$AJP_PORT --preferredClassLoader=java.net.URLClassLoader **--prefix=/jenkins** HTTP_PORT -1 AJP_PORT : 8102
我禁用了http,因为我想让我的用户去通过Apache而且我还添加了jenkins手册中所写的前缀jenkins。 不幸的是,我做错了什么,因为当我去aDomain.com/jenkins阿帕奇服务我一个404,这让我一个伤心的pandas。
更多信息:我正在做一个虚拟机上的testing,我正在使用:
Linux hostname 3.5.0-23-generic#35〜precise1-Ubuntu SMP Fri Jan 25 17:13:26 UTC 2013 x86_64 x86_64 x86_64 GNU / Linux
服务器版本:Apache / 2.2.22(Ubuntu)
jenkinsver。 1.509.2
我也加载了Apache2的
sudo a2enmode proxy sudo a2enmode proxy_http sudo a2enmode proxy_ajp
编辑:我忘了让你知道我的httpd.conf是一个空的文件谢谢你的时间
这是一个工作configuration背后的反向代理apache2在centos 6也ssl / tls卸载:
<VirtualHost *:443> ServerName jenkins.domain.tld ServerAdmin webmaster@localhost # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel info CustomLog /var/log/httpd/jenkins.access.log combined ErrorLog /var/log/httpd/jenkins.error.log SSLEngine on SSLProxyEngine On # List the enable protocol levels with which clients will be able to # connect. SSLProtocol All -SSLv2 -SSLv3 SSLHonorCipherOrder On # List the ciphers that the client is permitted to negotiate. # See the mod_ssl documentation for a complete list. SSLCipherSuite ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4 SSLCertificateFile /etc/pki/tls/certs/file.cer SSLCertificateChainFile /etc/pki/tls/certs/chain.cer SSLCertificateKeyFile /etc/pki/tls/private/file.key ProxyRequests Off ProxyPreserveHost On <Proxy *> Order deny,allow Allow from all </Proxy> ProxyPass / http://internal.domain.tld:8070/ retry=5 nocanon ProxyPassReverse / http://internal.domain.tld:8070/ AllowEncodedSlashes On Header edit Location ^http://(.*)$ https://$1 </VirtualHost>
使用AJP将请求代理到后端时,不需要ProxyPassReverse指令。
只要使用ProxyPass或ProxyPassMatch如果您需要将多个应用程序代理到tomcat , jboss或任何其他容器。
<VirtualHost *:80> ServerAdmin [email protected] DocumentRoot "/var/www" ServerName aDomain.com ErrorLog "/path/to/jenkinsVirtualHost.log" ProxyRequests off ProxyPass /jenkins ajp://127.0.0.1:8102/jenkins #ProxyPassMatch ^/(alfresco|jenkins|nexus)(.*) ajp://localhost:8102/$1$2 ProxyPreserveHost on </VirtualHost>