Created
March 24, 2017 11:52
-
-
Save valter-silva-au/e2786a2f9043cb2da8cce823a4c80066 to your computer and use it in GitHub Desktop.
Nginx with SSL as a Reverse Proxy for Jenkins
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
# create a local certificate for testing only | |
cd /etc/nginx | |
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/nginx/local-cert.key -out /etc/nginx/local-cert.crt |
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
# This file is managed by Chef. Changes will be overwritten.# | |
upstream jenkins { | |
server 127.0.0.1:8080 fail_timeout=0; | |
} | |
server { | |
listen 80; | |
return 301 https://$host$request_uri; | |
} | |
server { | |
listen 443; | |
server_name jenkins.example.com; | |
ssl_certificate /etc/nginx/local-cert.crt; | |
ssl_certificate_key /etc/nginx/local-cert.key; | |
ssl on; | |
ssl_session_cache builtin:1000 shared:SSL:10m; | |
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; | |
ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4; | |
ssl_prefer_server_ciphers on; | |
access_log /var/log/nginx/jenkins.access.log; | |
location / { | |
proxy_set_header Host $host; | |
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_connect_timeout 90; | |
proxy_send_timeout 90; | |
proxy_read_timeout 90; | |
proxy_buffer_size 4k; | |
proxy_buffers 4 32k; | |
proxy_busy_buffers_size 64k; | |
proxy_temp_file_write_size 64k; | |
proxy_pass http://127.0.0.1:8080; | |
proxy_redirect http:// https://; | |
# proxy_pass http://jenkins; | |
# proxy_redirect http://jenkins https://jenkins.example.com; | |
# This is the maximum upload size | |
client_max_body_size 10m; | |
client_body_buffer_size 128k; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment