zoukankan      html  css  js  c++  java
  • nginx动静分离

    192.168.126.8 主服务器
    192.168.126.7 静态节点
    192.168.126.6 动态节点
    [wangluoyuan]
    name=wanglouyuan1
    enabled=1
    gpgcheck=0
    baseurl=https://mirrors.aliyun.com/epel/7/x86_64/
    cost=1
    [centos]
    name=centos163
    enabled=1
    gpgcheck=0
    baseurl=http://mirrors.163.com/centos/7/os/x86_64/
    需要用到的网络源
    关闭防火墙
    Setenforce 0
    Systemctl stop firewalld
    第一步:下载nginx

    ╭─root@zxw ~
    ╰─➤ yum install nginx -y
    第二步:主服务配置动静分离规则
    ╭─root@zxw ~
    ╰─➤ vim /etc/nginx/nginx.conf

    location ~ html$ {
    proxy_pass http://192.168.126.7;
    }
    location ~ php$ {
    proxy_pass http://192.168.126.6;
    }
    第三步:检查并重启
    ╭─root@zxw ~
    ╰─➤ nginx -t
    nginx: /etc/nginx/nginx.conf syntax is ok

    ╭─root@zxw ~
    ╰─➤ systemctl restart nginx
    配置静态服务器192.168.126.7
    一:[root@zxw ~]# yum install nginx -y
    二:[root@zxw ~]# cd /usr/share/nginx/html/
    [root@zxw html]# ls
    404.html 50x.html index.html nginx-logo.png poweredby.png
    三:[root@zxw html]# vim index.html
    四:[root@zxw html]# systemctl restart nginx
    配置动态服务器192.168.126.6
    一:[root@006 ~]# yum install php httpd -y
    二:[root@006 ~]# vim /var/www/html/index.php
    <?php
    phpinfo();
    ?>
    ~
    三:[root@006 ~]# systemctl restart httpd

  • 相关阅读:
    博弈论《《转》》
    HDU 2509 Be the Winner
    SORT排序。。
    HDU 356 SNim
    博弈
    KM算法。《转载》以后看。
    jmeter(28)逻辑控制器 之 交替控制器
    jmeter(30)逻辑控制器 之 Switch Controller 暂时不写!
    jmeter(29)逻辑控制器 之 吞吐量控制器
    Shell一个文件并等待完成
  • 原文地址:https://www.cnblogs.com/itzhao/p/11249948.html
Copyright © 2011-2022 走看看