linux环境安装配置nginx
安装依赖
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