• linux安装nginx,设置代理,负载均衡


    Linux安装nginx


    首先下载:wget http://nginx.org/download/nginx-1.15.2.tar.gz

    解压:tar -xvf nginx-1.15.2.tar.gz

      cd /usr/local/nginx-1.15.2

      ./configure(此步若报错)

    ①:checking for C compiler … not found

      yum -y install gcc

      yum -y install gcc-c++

    ②:error: the HTTP rewrite module requires the PCRE library.

      You can either disable the module by using --without-http_rewrite_module
      option, or install the PCRE library into the system, or build the PCRE library
      statically from the source with nginx by using --with-pcre= option.

      yum -y install openssl openssl-devel

      

    然后:

      make

      make install

      /xxx/nginx-1.15.2/objs/nginx    或   /xxx/nginx/nginx (启动)

      /xxx/nginx/conf/nginx.conf  配置文件

      

      upstream xxx{
        server 127.0.0.1:8080 weight=8;   (weight: 数值越大 权重越高,down: 此服务器不参与轮询,backup   预留服务器(正式服务器挂了时,启动预留服务器))
        server 127.0.0.1:8888;
        server 127.0.0.1:9999;
      }

      location / {
        root  C:/abc/zxc;
        index index.html index.htm;
        proxy_pass http://xxx;

        (可选项)
        proxy_set_header Host $host;

        proxy_set_header X-Real-IP $remote_addr;

        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      }

      nginx.conf 配置文件生效 /xxx/nginx/sbin/nginx -c /xxx/nginx/conf/nginx.conf

  • 相关阅读:
    异常空格处理
    django
    django的ORM理解
    Django前后端分离
    Django企业项目实战
    Centos7 从 git version 1.8.3.1升级git version 2.32.0 全过程
    代码 80070005 Windows Uudate 遇到未知错误
    Power Shell Active Directory 批量创建分组
    H3C S5024E-PWR-X 端口镜像及抓包实例
    FusionCompute 忘记密码 重置操作
  • 原文地址:https://www.cnblogs.com/rempop/p/11594763.html
Copyright © 2020-2023  润新知