|
| 1 | +server { |
| 2 | + listen *:80; |
| 3 | + listen [::]:80 ipv6only=on; |
| 4 | + server_name {{ jenkins_nginx_fqdn }}; |
| 5 | + |
| 6 | + keepalive_timeout 60; |
| 7 | + server_tokens off; |
| 8 | + |
| 9 | + resolver 8.8.4.4 8.8.8.8 valid=300s; |
| 10 | + resolver_timeout 10s; |
| 11 | + |
| 12 | + access_log /var/log/nginx/jenkins-iojs-access.log; |
| 13 | + error_log /var/log/nginx/jenkins-iojs-error.log; |
| 14 | + |
| 15 | + gzip on; |
| 16 | + gzip_static on; |
| 17 | + gzip_disable "MSIE [1-6]\."; |
| 18 | + default_type text/html; |
| 19 | + gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript; |
| 20 | + |
| 21 | + location /downloads/ { |
| 22 | + alias /home/downloads/www/; |
| 23 | + autoindex on; |
| 24 | + } |
| 25 | + |
| 26 | + location / { |
| 27 | + rewrite ^ https://{{ jenkins_nginx_fqdn }}$request_uri permanent; |
| 28 | + } |
| 29 | + |
| 30 | + index index.html; |
| 31 | +} |
| 32 | + |
| 33 | +server { |
| 34 | + listen 443 default_server ssl spdy; |
| 35 | + server_name {{ jenkins_nginx_fqdn }}; |
| 36 | + |
| 37 | + ssl_certificate ssl/nodejs_chained.crt; |
| 38 | + ssl_certificate_key ssl/nodejs.key; |
| 39 | + |
| 40 | + ssl_ciphers "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH+aRSA+RC4 EECDH EDH+aRSA RC4 !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS"; |
| 41 | + ssl_prefer_server_ciphers on; |
| 42 | + ssl_dhparam ssl/dhparam.pem; |
| 43 | + ssl_session_timeout 5m; |
| 44 | + ssl_protocols TLSv1 TLSv1.1 TLSv1.2; |
| 45 | + ssl_session_cache shared:SSL:50m; |
| 46 | + |
| 47 | + ssl_stapling on; |
| 48 | + ssl_stapling_verify on; |
| 49 | + ssl_trusted_certificate ssl/nodejs_chained.crt; |
| 50 | + resolver 8.8.4.4 8.8.8.8 valid=300s; |
| 51 | + resolver_timeout 10s; |
| 52 | + |
| 53 | + access_log /var/log/nginx/jenkins-iojs-access.log; |
| 54 | + error_log /var/log/nginx/jenkins-iojs-error.log; |
| 55 | + |
| 56 | + gzip on; |
| 57 | + gzip_static on; |
| 58 | + gzip_disable "MSIE [1-6]\."; |
| 59 | + default_type text/html; |
| 60 | + gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript; |
| 61 | + |
| 62 | + location /downloads/ { |
| 63 | + alias /home/downloads/www/; |
| 64 | + autoindex on; |
| 65 | + } |
| 66 | + |
| 67 | + location /static/ { |
| 68 | + proxy_set_header Host $host; |
| 69 | + proxy_set_header X-Real-IP $remote_addr; |
| 70 | + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
| 71 | + proxy_set_header X-Forwarded-Proto $scheme; |
| 72 | + |
| 73 | + proxy_cache jenkins-static; |
| 74 | + proxy_cache_valid 200 1y; |
| 75 | + proxy_cache_use_stale error timeout invalid_header updating |
| 76 | + http_500 http_502 http_503 http_504; |
| 77 | + |
| 78 | + expires 1y; |
| 79 | + |
| 80 | + proxy_pass http://localhost:8080; |
| 81 | + proxy_read_timeout 240; |
| 82 | + } |
| 83 | + |
| 84 | + location /theme/ { |
| 85 | + alias /var/lib/jenkins/theme/; |
| 86 | + expires max; |
| 87 | + } |
| 88 | + |
| 89 | + location ~ ^/cli { |
| 90 | + return 403; |
| 91 | + } |
| 92 | + |
| 93 | + location / { |
| 94 | + |
| 95 | + proxy_set_header Host $host; |
| 96 | + proxy_set_header X-Real-IP $remote_addr; |
| 97 | + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
| 98 | + proxy_set_header X-Forwarded-Proto $scheme; |
| 99 | + |
| 100 | + # Fix the "It appears that your reverse proxy set up is broken" error. |
| 101 | + proxy_pass http://localhost:8080; |
| 102 | + proxy_read_timeout 90; |
| 103 | + |
| 104 | + # Hide jenkins headers because reasons |
| 105 | + proxy_hide_header X-Hudson-CLI-Port; |
| 106 | + proxy_hide_header X-Jenkins-CLI-Port; |
| 107 | + proxy_hide_header X-Jenkins-CLI2-Port; |
| 108 | + |
| 109 | + proxy_redirect http://localhost:8080 https://{{ jenkins_nginx_fqdn }}; |
| 110 | + } |
| 111 | +} |
0 commit comments