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