nginx configs notes

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
upstream jenkins {
server 127.0.0.1:8070 fail_timeout=0;
#server 127.0.0.1:8082 fail_timeout=0;
}

server {

listen 80;
server_name jenkins.jccafe.com.cn;

location ~^/.well-known/pki-validation/fileauth.txt$ {
set $content 2018011101520956gz3ikju0gw0w54zdwphbi0g08jz6usmxr85hgjay44xzb14i;
default_type text/html;
add_header Content-Type 'text/html; charset=utf-8';
return 200 $content;
}

location / {
return 301 https://$host$request_uri;
}
}

server {
listen 443 ssl;
server_name jenkins.jccafe.com.cn;

ssl_certificate ssl/1_jccafe.com.cn_bundle.crt;
ssl_certificate_key ssl/2_jccafe.com.cn.key;

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://jenkins;
# Required for new HTTP-based CLI
#proxy_http_version 1.1;
#proxy_request_buffering off;
#proxy_buffering off; # Required for HTTP-based CLI to work over SSL
# workaround for https://issues.jenkins-ci.org/browse/JENKINS-45651
#add_header 'X-SSH-Endpoint' $host':50022' always;
}
}