• nginx nfs服务


    一、nginx服务

    1、二进制安装nginx包

    [root@bogon ~]# ls /etc/yum.repos.d/

    [root@bogon ~]# cd /etc/yum.repos.d/

    [root@bogon yum.repos.d]# yum install epel-release –y

    [root@bogon yum.repos.d]# yum install nginx –y

    2、作为web服务修改配置文件

    [root@bogon yum.repos.d]# vim /etc/nginx/nginx.conf

     

    3、让配置生效,验证配置

    [root@bogon html]# systemctl start nginx

    [root@bogon html]# systemctl status nginx

    [root@bogon html]# systemctl stop firewalld

    http://192.168.24.128/a/b/c.txt

     

    二、nfs服务

    1、二进制安装nfs

    [root@bogon /]# yum install rpcbind nfs-utils –y 

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

    [root@bogon ~]# yum install rpcbind

    [root@bogon ~]# ls /var/www/html

    [root@bogon ~]# cat /var/www/html/web1.txt

    [root@bogon ~]# vim /var/www/html/web1.txt

    [root@bogon ~]# cat /var/www/html/web1.txt

    [root@bogon ~]# echo hello world. >> /var/www/html/web1.txt

    [root@bogon ~]# cat /var/www/html/web1.txt

     

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

    [root@bogon ~]# echo hello world. >> /var/www/html/web1.txt

    [root@bogon ~]# cat /var/www/html/web1.txt

     

    三、nginx反向代理三台web

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

    [root@bogon www]# yum -y install tree

    [root@bogon www]#  echo web-8082 > 8082/index.html

    [root@bogon www]#  echo web-8080 > 8080/index.html

    [root@bogon www]#  echo web-8081 > 8081/index.htm

    [root@bogon www]# iptables -F

    [root@bogon www]# vim /etc/nginx/nginx.conf

    [root@bogon www]# /usr/sbin/nginx -s reload

     

     

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

     

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

     

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

    [root@bogon share]#vim /etc/nginx/nginx.conf

    [root@bogon share]#systemctl reload nginx

    [root@bogon share]#cat index.html

    welcome Beijing

    [root@bogon share]#

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

    [root@bogon ~]# yum install gcc-* glibc-* openssl openssl-devel pcre pcre-devel zlib zlib-devel -y

    [root@bogon ~]# tar -zxvf nginx-1.10.3.tar.gz
    [root@bogon ~]# cd nginx-1.10.3 [root@bogon nginx-1.10.3]# ./configure --prefix=/usr/local/nginx
    [root@bogon nginx-1.10.3]# make && make install
    [root@bogon nginx-1.10.3]# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf 

  • 相关阅读:
    【css】垂直居中的几种写法
    【gulp】gulp-file-include 合并 html 文件
    【gulp】gulp + browsersync 构建前端项目自动化工作流
    【nodejs】exports 和 module.exports 的区别
    【nodejs】初识 NodeJS(四)
    【nodejs】初识 NodeJS(三)
    【nodejs】初识 NodeJS(二)
    【nodejs】初识 NodeJS(一)
    【规范】前端编码规范——注释规范
    【规范】前端编码规范——jquery 规范
  • 原文地址:https://www.cnblogs.com/niejinmei/p/6592436.html
Copyright © 2020-2023  润新知