linux环境安装配置nginx
程序员文章站
2022-04-30 22:37:45
安装依赖 解压 安装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
上一篇: JS模拟的QQ面板上的多级可展开的菜单