zoukankan      html  css  js  c++  java
  • Linux安装nginx

    1.Linux安装Nginx
      1.1将Nginx素材内容上传到/usr/local目录(pcre,zlib,openssl,nginx)
      1.2安装pcre库
        1.2.1 cd到/usr/local目录
        1.2.2 tar -zxvf pcre-8.36.tar.gz 解压
        1.2.3 cd pcre-8.36目录
         1.2.4 执行./configure 编译 如果报错configure: error: no acceptable C compiler found in $PATH
        安装gcc 库:yum install -y gcc gcc-c++ 如果发现进程被占用:kiil -9 PID 然后再次执行yum安装gcc即可
        在此./configure编译
        1.2.5 make编译
        1.2.6 make install安装

      1.3安装zlib库
        1.3.1 cd到/usr/local目录
        1.3.2 tar -zxvf zlib-1.2.8.tar.gz
        1.3.3 cd zlib-1.2.8目录
        1.3.4 ./configure编译
        1.3.5 make
        1.3.6 make install

    1.4安装ssl
        1.4.1 cd到/usr/local目录
        1.4.2 tar -zxvf open-1.0.1.tar.gz
        1.4.3 cd open-1.0.1l目录
        1.4.4 ./config编译
        1.4.5 make
        1.4.6 make install

    1.5安装Nginx
        1.5.1 cd到/usr/local目录
        1.5.2 tar -zxvf nginx-1.5.9.tar.gz
        1.5.3 cd nginx-1.5.9目录
        1.5.4 ./configure --prefix=/usr/local/nginx 注意编译之后的文件都放在/usr/local/nginx
        1.5.5 make
        1.5.6 make install

    1.6启动测试
      启动命令:/usr/local/nginx/sbin/nginx
      本机浏览器测试:虚拟机IP地址即可 如果访问不了关闭防火墙 centos7关闭防火墙命令:systemctl stop firewalld.service 禁用:systemctl disable firewalld.service
    2.keepalived高可用工具
      2.1 将keepalived上传到linux系统当中
      2.2 cd /usr/local目录
      2.3 tar -zxvf keepalived-xxxxxxxxx
      2.4 切换到解压目录
      2.5 yum install -y openssl openssl-devel
      2.5 ./configure --prefix=/usr/local/keepalived 编译,将编译文件放到/usr/local/keepalived
      2.6 make
      2.7 make install
      2.8 在/etc/keepalived 创建目录: mkdir /etc/keepalived
      2.9 cp /usr/local/keepalived/etc/keepalived/keepalived.conf /etc/keepalived/
      2.10 cp /usr/local/keepalived/etc/rc.d/init.d/keepalived /etc/init.d/
      2.11 cp /usr/local/keepalived/etc/sysconfig/keepalived /etc/sysconfig/
      2.12 ln -s /usr/local/sbin/keepalived /usr/sbin/
      2.13 ln -s /usr/local/keepalived/sbin/keepalived/sbin/
      2.14 将nginx启动脚本和keepalived.conf配置上传到/etc/keepalived
      2.15 主机:修改keepalived.conf配置文件
      interface 配置成与主机相同的网络 ip a
      mcast_src_ip 配置成自己机器的IP
      virtual_ipaddress {
        192.168.7.88 # 虚拟ip,也就是解决写死程序的ip怎么能切换的ip,也可扩展,用途广泛。可配置多个。
      }
      2.16 启动keepalived 如果报错:Job for keepalived.service failed because the control process exited with error code. See "systemctl status keepalived.service" and "journalctl -xe" for details.
        解决办法:rm /usr/sbin/keepalived
             ln -s /usr/local/keepalived/sbin/keepalived /usr/sbin/
      2.17 备机keepalived.conf
        state BACKUP 备机
        interface 配置成与主机相同的网络 ip a
        mcast_src_ip 配置成自己机器的IP
        priority 90
        virtual_ipaddress {
          192.168.7.88 # 虚拟ip,也就是解决写死程序的ip怎么能切换的ip,也可扩展,用途广泛。可配置多个。
        }

  • 相关阅读:
    Unity实现Bezier曲线的移动(三点之间的Bezier曲线的移动)
    error CS2001: Source file `Assets/Pro Standard Assets/Image Based/SaveGameData.cs' could not be found 错误
    Some objects were not cleaned up when closing the scene. (Did you spawn new GameObjects from OnDestroy?) 错误
    Unity拖拽旋转2D物体
    Unity预编译
    Activity的四种launchMode
    接入华为海外SDK支付,按下home键,之后支付页面被销毁
    Android动态权限申请
    armeabi与armeabi-v7a的区别
    win7上帝模式
  • 原文地址:https://www.cnblogs.com/ws1149939228/p/12295858.html
Copyright © 2011-2022 走看看