So you’ve decided to setup Jenkins to use with Mulesoft. Congratulations, this will be the first step on a long road of automation that will make your life as a DevOps Engineer better. I’m assuming Ubuntu in these instructions.

Housekeeping and Downloads:
Jenkins (Instructions)
Java SDK (Instructions)
Maven (Instructions)

Install Jenkins with the Recommended Plugins, then add the Maven Integration as well.

WAIT!!! Did you think about Security yet?? Jenkins is an amazing system, but using Jenkins can create HUGE security holes? Are you even using HTTPS yet? No? You should be. Download NGINX. This tutorial will showing you a self-signed certificate, and it’s ok to get started, but you’ll need to get a real certificate soon. Yes, your browser will start throwing an “untrusted” site error, but you NEED to be encrypting your traffic.

Configuring NGINX for modern security first edit /etc/nginx/nginx.conf, remove the TLS1 and TLS1.1 options (they are insecure)

Then follow instructions for setting up Jenkins behind NGINX ssl

Heres my configuration file in /etc/nginx/sites-available/default

# Default server configuration
#

server {
listen 80 default_server;
listen [::]:80 default_server;
server_name myserver.com;
return 301 https://$server_name$request_uri;
}
server {

# SSL configuration
#
listen 443 ssl default_server;
listen [::]:443 ssl default_server;
#

access_log /var/log/nginx/jenkins.access.log;
error_log /var/log/nginx/jenkins.error.log;

#
include snippets/self-signed.conf;
#include snippets/ssl-params.conf;

server_name myserver.com;

location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
# try_files $uri $uri/ =404;
include /etc/nginx/proxy_params;
proxy_pass http://localhost:8080;
proxy_read_timeout 90s;
# Fix potential "It appears that your reverse proxy set up is broken" error.
proxy_redirect http://localhost:8080 https://myserver.com;
}
}

You will also have to add the file self-signed.conf to the folder snippets:

ssl_certificate /etc/nginx/ssl/nginx.crt;
ssl_certificate_key /etc/nginx/ssl/nginx.key;

One Last Command: sudo service nginx restart
Awesome. Congratulations, you just setup a Jenkins Server, and made it secure over HTTPS. More Steps to follow!