Jenkins服务使用nginx代理服务器做负载均衡


学习nginx代理服务器做负载均衡的使用

在本地安装Nginx

1.下载nginx

http://nginx.org/en/download.html         下载稳定版本,以nginx/Windows-1.12.2为例,直接下载 nginx-1.12.2.zip

下载后解压,解压后如下

2.启动nginx

有很多种方法启动nginx

(1)直接双击nginx.exe,双击后一个黑色的弹窗一闪而过

(2)打开cmd命令窗口,切换到nginx解压目录下,输入命令 nginx.exe 或者 start nginx ,回车即可

3.配置nginx的配置文件,是conf目录下的nginx.conf

添加如下的加粗的部分后重新启动nginx,只需要执行命令 nginx -s reload 

#gzip on;
upstream tomcat_server{
server localhost:8080;
}

server {
listen 80;
server_name localhost;

#charset koi8-r;

#access_log logs/host.access.log main;

location / {
root html;
index index.html index.htm;
proxy_pass http://tomcat_server;
}

4.访问127.0.0.1

此时会自动跳转到 localhost:8080,也就是Jenkins的登录页面:http://127.0.0.1/login?from=%2F


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM