Created
May 11, 2018 18:49
-
-
Save liemle3893/1c14bc28cf4943a5acbbac8e8b956e9a to your computer and use it in GitHub Desktop.
Jenkins subdomain - NginX config. ( /etc/nginx/sites-available/jenkins.your-domain.com )
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
server_name jenkins.your-domain.com; | |
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; | |
# Fix the "It appears that your reverse proxy set up is broken" error. | |
proxy_pass http://127.0.0.1:8080; | |
proxy_read_timeout 90; | |
proxy_redirect http://127.0.0.1:8080 https://jenkins.your-domain.com; | |
# Required for new HTTP-based CLI | |
proxy_http_version 1.1; | |
proxy_request_buffering off; | |
# workaround for https://issues.jenkins-ci.org/browse/JENKINS-45651 | |
add_header 'X-SSH-Endpoint' 'jenkins.your-domain.com:50022' always; | |
} | |
listen 443 ssl; # managed by Certbot | |
ssl_certificate /etc/letsencrypt/live/your-domain.com/fullchain.pem; # managed by Certbot | |
ssl_certificate_key /etc/letsencrypt/live/your-domain.com/privkey.pem; # managed by Certbot | |
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot | |
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot | |
} | |
#################################################################################### | |
# | |
# Make sure to create soft link to /etc/nginx/sites-enabled/ | |
# $ ln -s /etc/nginx/sites-available/jenkins.your-domain.com /etc/nginx/sites-enabled/jenkins.your-domain.com | |
# $ service nginx -t | |
# $ service nginx restart | |
# | |
#################################################################################### |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Update: (Support SSL) (Using certbot, but it's may work seamlessly with others CA too)