一、安装配置Jenkins
1.准备工作
#安装JAVA
yum install -y java
2.安装Jenkins
#更换jenkins软件源仓库
wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
#导入密钥
rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
#yum安装jenkins
yum install -y jenkins
#查看jenkins安装的文件夹
rpm -ql jenkins
3.修改配置
vim /etc/sysconfig/jenkins
#JENKINS_PORT="8080"
#JENKINS_USER="root"
4.启动Jenkins服务
systemctl start jenkins.service
#开机自启
systemctl enable jenkins.service
systemctl status jenkins.service
浏览器访问对应端口,10.0.10.210:8080
二、Nginx域名转发
1.本地机Hosts清单
vim /etc/hosts
#添加一行10.0.10.210 myjenkins.com
2.远程机监听转发
vim /etc/nginx/conf.d/jenkins.conf
server {
listen 80;
server_name myjenkins.com;
error_log /var/log/git.error.log ;
client_max_body_size 60M;
client_body_buffer_size 512k;
location / {
port_in_redirect on;
proxy_pass http://127.0.0.1:8080$request_uri;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
#重启Nginx
nginx -t
nginx -s reload
systemctl restart nginx