Docker部署
docker run \
-u root \
-d \
-p 8380:8080 \
-p 53000:50000 \
-v /opt/jenkins/data:/var/jenkins_home \
-v /var/run/docker.sock:/var/run/docker.sock \
--name jenkins \
jenkinsci/blueocean
配置Ngx
proxy_set_header
是必须的,这样JKS不会提示警告
之所以配置根目录映射jenkins是因为jenkins的访问主页也是http://127.0.0.1:8380
,任何对https://<ip>/aa/bb
都会映射到http://127.0.0.1:8380/aa/bb
如果在docker run
配置了前缀--env JENKINS_OPTS="--prefix=/jenkins"
,此时ngx就可以配置成location /jenkins
vim /etc/nginx/conf.d/jenkins.conf
# 内容如下
server {
listen 443;
server_name <ip>;
location / {
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_set_header Host $host;
proxy_pass http://127.0.0.1:8380;
}
}
访问https://<ip>
即可进入Jenkins
Jenkins插件国内源
进入https://<ip>/manage/pluginManager/advanced
配置清华镜像http://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/update-center.json
评论区