3

How can I configure Jenkins to run on the HTTP port 80, only accessible to a certain Apache virtual server only on a specific subdomain?

I have one virtual server: business.com running on the server. I have another, personal.com running as well.

I want Jenkins to be at http://jenkins.personal.com:80/

Is this possible? How can I do this?

Thanks in advance.

I'm using Ubuntu 13.10 with Apache2. Any other information can be made available :)

1 Answer 1

2

You don't need to serve Jenkins directly on port 80. You can use your Apache2 instalation to proxy Jenkins, with the Apache2 proxy mod (you will need to enable the proxy mod & restart Apache2).

Here you can check my own Jenkins installation proxied by Apache2, indeed I serve it via HTTPS (443), HTTP (80) just redirect to secured connection.

<VirtualHost *:80>
    ServerAdmin [email protected]
    ServerName jenkins.ociotec.com
    ErrorLog ${APACHE_LOG_DIR}/jenkins.ociotec.com.error.log
    CustomLog ${APACHE_LOG_DIR}/jenkins.ociotec.com.access.log combined
    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
</VirtualHost>

<IfModule mod_ssl.c>
    <VirtualHost *:443>
        ServerAdmin [email protected]
        ServerName jenkins.ociotec.com
        ErrorLog ${APACHE_LOG_DIR}/jenkins.ociotec.com.error.log
        CustomLog ${APACHE_LOG_DIR}/jenkins.ociotec.com.access.log combined
        SSLEngine on
        SSLProxyEngine on
        SSLCertificateFile    /etc/apache2/ssl/jenkins.ociotec.com.cert
        SSLCertificateKeyFile /etc/apache2/ssl/jenkins.ociotec.com.key
        ProxyPreserveHost On
        ProxyPass / http://ociotec.com:8001/
        ProxyPassReverse / http://ociotec.com:8001/
    </VirtualHost>
</IfModule>

As you can seet at the end, my Jenkins is served on http://ociotec.com:8001, but proxied by Apache in https://jenkins.ociotec.com.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .