1.修改nginx 的config文件瓮恭,一般在/etc/nginx/nginx.conf,在server 中添加location
塊
···
location /jenkins{
proxy_pass http://jenkins_ip:jenkins_port;
proxy_redirect http:// https://;
sendfile off;
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_max_temp_file_size 0;
#this is the maximum upload size
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_temp_file_write_size 64k;
# 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
}
···
2.修改jenkins的配置文件缆镣,在centos系統(tǒng)中师抄,位于/etc/sysconfig/jenkins,在
JENKINS_ARGS
中追加prefix
···
JENKINS_ARGS="--prefix=/jenkins"
···
- 重啟nginx ,重啟jenkins
nginx -s reload
service jenkins restart