0%

Jenkins-域名解析+Nginx代理

配置Jenkins URL

配置域名解析

添加Nginx解析

nginx配置文件如下:

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
server {
listen 80;
server_name jenkins.visualchina.com;
location / {
rewrite ^/(.*)$ http://jenkins.visualchina.com/jenkins;
}
location /jenkins {
proxy_pass http://127.0.0.1:8080/jenkins;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded_For $proxy_add_x_forwarded_for;
}

}

server {
listen 443 ssl;
server_name jenkins.visualchina.com;
access_log /var/log/nginx/jenkins.visualchina.com main;
error_log /var/log/nginx/jenkins.visualchina.com.error.log;

ssl on; #ssl功能开启
ssl_certificate sslfile/visualchina.pem; #证书路径
ssl_certificate_key sslfile/visualchina.key;


location / {
rewrite ^/(.*)$ http://jenkins.visualchina.com/jenkins;
}
location /jenkins {
proxy_pass http://127.0.0.1:8080/jenkins;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded_For $proxy_add_x_forwarded_for;
}
}