Jenkins服務使用nginx代理伺服器做負載均衡
阿新 • • 發佈:2018-12-09
學習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