1

What is the recommended method for setting up HTTPS for Jenkins?

  1. Setting up HTTPS in Jenkins itself?
  2. Using Apache as proxy for HTTPS setup?

We have a VM in which Jenkins is the only application.

andreasgk
  • 673
  • 1
  • 12
  • 30

1 Answers1

2

Method I use and I believe to be the most simple is to use nginx as proxy, example configuration:

root@redacted-jenkins-2:/etc/nginx/sites-available# cat jenkins_http.conf
#Ansible managed

server {
   listen 80;
   server_name jenkins.redacted.com.ar;
   return 301 https://jenkins.redacted.com.ar$request_uri;
}

server {
   listen 443 ssl;
   server_name jenkins.redacted.com.ar;
   ssl_certificate /etc/letsencrypt/live/jenkins.redacted.com.ar/fullchain.pem;
   ssl_certificate_key /etc/letsencrypt/live/jenkins.redacted.com.ar/privkey.pem;
   ssl_trusted_certificate /etc/letsencrypt/live/jenkins.redacted.com.ar/fullchain.pem;
   include /etc/nginx/snippets/ssl.conf;
   location / {
     proxy_set_header        Host $host:$server_port;
     proxy_set_header        X-Real-IP $remote_addr;
     proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
     proxy_set_header        X-Forwarded-Proto $scheme;
     proxy_redirect http:// https://;
     proxy_pass              http://127.0.0.1:8080;
   }

}
Marcos Pagnucco
  • 351
  • 1
  • 5