Linux基础实操五

实操一:nginx服务

二进制安装nginx包1)

1)#yum clean all

2)#yum install epel-release -y

3)#yum install nginx -y

1)

2)

2)

2)

3)

3)

3)

3)

3)

作为web服务修改配置文件

#vim /usr/local/nginx/conf/nginx.conf ---->:wq

 

让配置生效,验证配置

 #systemctl reload nginx

 

实操二:nfs服务

二进制安装nfs

#yum clean all

#yum install rpcbind nfs-utils -y

 

作为共享存储挂载在三台web的网站根目录下

环境介绍:nfs服务端:192.168.145.130

                     web1:192.168.145.131

                     web2:192.168.145.132

                     web3:192.168.145.133

nfs服务端下操作:

             #mkdir /share

             #touch /share/share.txt

            #echo share666 > /share/share.txt    

            #vim /etc/exports

            #systemctl enable nfs-server.service

           #systemctl enable rpcbind.service

           #systemctl start rpcbind.service

           #systemctl start nfs-server.service

在Xshell中全部会话窗口一块操作:

        #yum clean all

       #yum install rpcbind nfs-utils -y

       # mount -t nfs 192.168.145.130:/share /usr/share/nginx/html

       #df

实现,在任意一台web上修改的结果,其余两台都可以看到

     nfs服务端:#chmod -R o+w /share/

          web1:#touch /share/share1.txt

          web2:#ls /share/

                    #touch /usr/share/nginx/html/share2.txt

          web3:#ls /usr/share/nginx/html/

实操三:nginx反向代理三台web

实现基于轮询的方式调度三台web,并验证结果

    #vim /etc/nginx/nginx.conf

实现基于权重的方式调度三台web,并验证结果

      #vim /etc/nginx/nginx.conf

实现基于hash的方式调用三台web,并验证结果 

     #vim /etc/nginx/nginx.conf

 

实操四:

nginx反向代理+三台web+nfs共享存储实现集群配置

 

实操五:

源码安装nginx,并按照作业一描述的那样去测试使用

    #tar xvf nginx-1.10.3.tar.gz 

    #./configure --prefix=/usr/local/nginx

    #make && make install

原文地址:https://www.cnblogs.com/Michael--chen/p/6591527.html