安裝依賴 解壓 安裝nginx 配置Tomcat伺服器 upstream tomcats{ server localhost:8080 weight=3; # weigh表示權重,越大訪問的機率越多 server localhost:8880 weight=6; } location / { # 這 ...
安裝依賴
yum install gcc yum install pcre-devel yum install zlib zlib-devel yum install openssl openssl-devel
解壓
tar -zxvf nginx-1.13.7.tar.gz
安裝nginx
//進入nginx目錄 cd /usr/local/nginx //執行命令 ./configure
//執行make命令 make //執行make install命令 make install
配置Tomcat伺服器
cd /usr/local/nginx/conf
vi nginx.conf
upstream tomcats{
server localhost:8080 weight=3; # weigh表示權重,越大訪問的機率越多
server localhost:8880 weight=6;
}
location / {
# 這裡使用定義 serverlist
proxy_pass http://tomcats;
index index.html index.htm;
}
啟動nginx
cd /usr/local/nginx/sbin/
./nginx