Linux环境搭建nginx负载
安裝依賴
# yum install gcc
# yum install pcre-devel
# yum install zlib zlib-devel
# yum install openssl openssl-devel
//一鍵安裝上面四個(gè)依賴
# yum -y install gcc zlib zlib-devel pcre-devel openssl openssl-devel
下載nginx的tar包
# cd /usr/local
# mkdir nginx
# cd nginx
//下載tar包
# wget http://nginx.org/download/nginx-xxxx.tar.gz
//解壓
# tar -xvf nginx-xxx.tar.gz
安裝nginx
# cd /usr/local/nginx
//執(zhí)行命令
# ./configure
//執(zhí)行make命令
# make
//執(zhí)行make install命令
# make install
啟動(dòng)Nginx
//測(cè)試配置文件
# /nginx/sbin/nginx –t
//啟動(dòng)命令
# /nginx/sbin/nginx
//停止命令
# /nginx/sbin/nginx -s stop
配置集群
# cd /usr/local/nginx/conf
//修改nginx.conf文件,在http{}中添加下列語(yǔ)句
# vim nginx.conf
upstream web_app{
server 192.168.93.129:8080 weight=1;
server 192.168.93.130:8080 weight=1;
ip_hash;
}
server {
listen 8080;
server_name 192.168.93.128;
location / {
proxy_pass http://web_app;
}
}
client_max_body_size 100m;
?
轉(zhuǎn)載于:https://www.cnblogs.com/linkong1081/articles/9890229.html
總結(jié)
以上是生活随笔為你收集整理的Linux环境搭建nginx负载的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 大讲堂 | 预测时间敏感的机器学习模型建
- 下一篇: linux解决病毒系列之一,删除十字符l