Andrew Maxwell

How to configure Jenkins to run on port 80 with Google Compute Engine Debian OS

July 16, 2014

So, you’ve just installed Jenkins on your very own compute engine instance but now you want to access it via an easy to remember domain name. Follow the steps below to access your Jenkins install via your custom domain name.

Step 1.

Install Jenkins if you haven’t done so already.

Step 2.

Setup your custom subdomain using Google Cloud DNS

Step 3.

Install Apache2 and mod-proxy on your server. Apache2 and mod-proxy will be used to proxy your jenkins server to port 80 so that it can be accessed via your domain name.
apt-get install apache2
apt-get install libapache2-mod-proxy-html
a2enmod proxy_http

Step 4.

Copy your default website found in apache, duplicate the file and rename it.
cd /etc/apache2/sites-available/
cp default jenkins.example.com

Step 5.

Edit the contents of your new example.com domain.
vim example.com

Delete everything in the file and paste in the following settings:
<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName jenkins.example.com

    ProxyRequests Off
    <Proxy *>
        Order deny,allow
        Allow from all
    </Proxy>
    ProxyPreservehost on
    ProxyPass / http://localhost:8080/
</VirtualHost>

Step 6.

Disable the default website and enable your new website.
a2dissite default
a2ensite jenkins.example.com

Step 7.

Restart apache.
service apache2 reload

Step 8.

Open your favorite browser and visit jenkins.example.com

Leave a Reply

You must be logged in to post a comment.