在子域和不同的端口上运行jachekins在apache2后面

时间:2016-12-18 20:25:20

标签: apache jenkins

我试图在http://localhost:8080/显示jenkins实例(在http://ci.domain.com:80/上运行)。
现状:
*浏览ci.domain.com会向我提供domain.com的内容 *浏览ci.domain.com:8080显示jenkins
*浏览domain.com:8080显示jenkins
理想状态:
*浏览ci.domain.com显示jenkins
*浏览ci.domain.com:8080重定向到ci.domain.com
*如果端口8080上没有任何内容正在运行,浏览domain.com:8080会执行服务器的操作。

我当前的apache站点配置(按预期工作将流量转移到HTTPS)如下:

<VirtualHost *:8080>
    ServerName ci.domain.com
    ServerAlias ci
    Redirect temp / http://ci.domain.com/
</VirtualHost>
<VirtualHost *:80>
    ServerName ci.domain.com
    ServerAlias ci

    ProxyRequests Off
    ProxyPreserveHost On
    AllowEncodedSlashes NoDecode
    <Proxy http://localhost:8080/*>
        Order deny,allow
        Allow from all
    </Proxy>
    ProxyPass / http://localhost:8080/ nocanon
    ProxyPassReverse / http://localhost:8080/
</VirtualHost>

<VirtualHost *:80>
    ServerName domain.com
    ServerAlias www.domain.com
    DocumentRoot /var/www/domain.com
    Redirect permanent / https://domain.com/
</VirtualHost>
<VirtualHost *:443>
    ServerName domain.com
    ServerAlias www.domain.com
    DocumentRoot /var/www/domain.com

        <Directory /var/www/domain.com/>
            Options Indexes FollowSymLinks
            AllowOverride All
            Require all granted
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        <IfModule mod_dir.c>
            DirectoryIndex index.php index.pl index.cgi index.html index.xhtml $
        </IfModule>

    SSLEngine on
    SSLCertificateFile /etc/letsencrypt/live/domain.com/cert.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/domain.com/privkey.pem
    SSLCertificateChainFile /etc/letsencrypt/live/domain.com/fullchain.pem

    <FilesMatch "\.(cgi|shtml|phtml_php)$">
        SSLOptions +StdEnvVars
    </FilesMatch>
</VirtualHost>

感谢任何帮助。

0 个答案:

没有答案