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

  • 相关阅读:
    如何进行有效沟通避免出现误会
    如何进行有效沟通
    怎样提高自己的团队合作能力
    javaScript简介
    css文本格式详解
    css简介及相关概念
    WebGL10---3D模型的加载与使用
    Canvas绘图与动画详解
    Canvas绘制时钟
    WebGL9----将canvas作为纹理,将动画作为纹理(2)
  • 原文地址:https://www.cnblogs.com/itzhao/p/11249948.html
Copyright © 2011-2022 走看看