(1)安装相关依赖
sudo yum -y install openssl openssl-devel pcre pcre-devel zlib zlib-devel gcc gcc-c++
(2)上传nginx安装包
rz nginx-1.12.2.tar.gz
(3)解压安装包
tar -zxvf nginx-1.12.2.tar.gz -C /opt/module
(4)编译安装
./configure --prefix=/opt/module/nginx make && make install
(5)启动nginx
sbin/nginx #关闭nginx sbin/nginx -s stop
(6)WEB端访问
http://hadoop102:80/2、配置负载均衡
(1)打开配置文件
cd /opt/module/nginx/conf vim nginx.conf
(2)修改如下配置
http{ #gzip on; #配置代理服务器 upstream logcluster{ server hadoop102:8081 weight=1; server hadoop103:8081 weight=1; server hadoop104:8081 weight=1; } server { listen 80; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { #root html; #index index.html index.htm; #代理的服务器集群,命名随意,但是不能出现下划线 proxy_pass http://logcluster; proxy_connect_timeout 10; } ...... }
(3)启动nginx
sbin/nginx3、资源下载
链接:https://pan.baidu.com/s/1L9DYgopgIDSj5avxsF2gig 提取码:xufn
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)