Skip to content

Instantly share code, notes, and snippets.

@CarterZhou
Created May 26, 2017 07:21
Show Gist options
  • Select an option

  • Save CarterZhou/14249d150467ec235ec2f4baf5f54950 to your computer and use it in GitHub Desktop.

Select an option

Save CarterZhou/14249d150467ec235ec2f4baf5f54950 to your computer and use it in GitHub Desktop.
Script to install and secure Jenkins
# Install Jenkins
wget -q -O - https://pkg.jenkins.io/debian/jenkins-ci.org.key | sudo apt-key add -
sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
sudo apt-get update
sudo apt-get install -y jenkins ant
# Configure a reverse proxy on Nginx to secure Jenkins
server {
listen 443 ssl;
listen [::]:443;
# SSL certificate is here
server_name your.domain;
access_log /var/log/nginx/jenkins.access.log;
error_log /var/log/nginx/jenkins.error.log;
location / {
include /etc/nginx/proxy_params;
proxy_pass http://localhost:8080;
proxy_read_timeout 90s;
proxy_redirect http://localhost:8080 https://your.domain;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment