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
原文地址https://www.cnblogs.com/zhainan-blog/archive/2019/07/24/11235767.html