首页 > 系统相关 >nginx 负载均衡

nginx 负载均衡

时间:2023-06-01 16:36:55浏览次数:41  
标签:负载 http myapp1 server srv1 nginx 均衡 com example

负载均衡

http://nginx.org/en/docs/http/load_balancing.html

轮询 (不写 directive )

    upstream myapp1 {
        server srv1.example.com;
        server srv2.example.com;
        server srv3.example.com;
    }

最小活跃连接数

    upstream myapp1 {
        least_conn;
        server srv1.example.com;
        server srv2.example.com;
        server srv3.example.com;
    }

哈希

upstream myapp1 {
    ip_hash;
    server srv1.example.com;
    server srv2.example.com;
    server srv3.example.com;
}

 

反向代理

http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_pass

单个

location /name/ {
    proxy_pass http://127.0.0.1/remote/;
}

群组

http {
    upstream myapp1 {
        server srv1.example.com;
        server srv2.example.com;
        server srv3.example.com;
    }

    server {
        listen 80;

        location / {
            proxy_pass http://myapp1;
        }
    }
}

 

标签:负载,http,myapp1,server,srv1,nginx,均衡,com,example
From: https://www.cnblogs.com/zno2/p/6028920.html

相关文章

  • 离线安装nginx
    离线安装nginxgcc-c++该链接内有安装nginx所需的环境openssl、pcre、zlib直接执行该命令安装即可rpm-Uvh*.rpm--nodeps--force将下载好的nginx源码包(nginx-1.21.6.tar.gz)解压缩到/usr/local目录下,顺序执行以下命令cdnginx-1.21.6./configuremake&&makeinstall......
  • Nginx配置隐藏模块后的.php后缀
    要在Nginx中配置隐藏框架模块后的.php后缀,并将URL重写为http://example.com/index/user/profile,请按照以下步骤进行操作:1.  打开Nginx配置文件。2.  添加以下配置,启用URL重写和模块隐藏:server{listen80;server_nameexample.com;root/pat......
  • nginx+tomcat+https
    nginx:config :location/{add_headerContent-Security-Policyupgrade-insecure-requests;proxy_passhttp://127.0.0.1:8080;proxy_set_headerHost$host:$server_port;proxy_set_headerREMOTE_HOST$remote_addr;proxy_set_headerX-Real-IP$remot......
  • 在 nginx 服务器上发布vue项目 步骤与配置
    1.在vscode中使用yarnbuild:prod进行vue项目的发布2.进入发布文件3.下载nginx的windows版https://nginx.org/en/download.html4.将发布好的文件放入nginx解压后的html文件夹中5.修改nginx的配置文件打开nginx的配置文件配置完成使用命令打开nginx至此发布......
  • 负载均衡集群ipvsadm命令及基本用法
     ipvsadm是LVS在应用层的管理命令,我们可以通过这个命令去管理LVS的配置。需要使用yum单独安装。基本用法:ipvsadmCOMMAND[protocol]service-address        [scheduling-method][persistenceoptions]ipvsadmcommand[protocol]service-address  ......
  • 【Gatling】性能测试工具的安装与负载测试
    一、官网https://gatling.io/open-source/ 二、安装JDK资料太多了,不写了https://jingyan.baidu.com/article/48b558e3f135687f38c09a03.html 三、安装Gatling 下载完解压,配置下环境变量Path即可 四、使用简单使用可以参考第一个链接  参考链接:什么是Gatling......
  • nginx创建基本认证(Basic Authorization)
     步骤一:创建用户名密码#创建用户名密码文件htpasswd-dbchtpasswd.usersuserpassword密码也可以通过opensslpasswdpassword来创建格式为user:encrypr_password可以多个 步骤二:Nginx配置server{listen80;server_namexxx.com;locat......
  • Linux系统下安装配置Nginx
    Linux系统下安装配置Nginx打开Nginx下载界面找想要下载的版本,复制下载链接进入/usr/local/目录中,执行如下命令下载Nginx安装包wget-chttp://nginx.org/download/nginx-1.24.0.tar.gz解压安装包tar-zxvfnginx-1.24.0.tar.gz安装Nginx相关依赖yuminstall-ygcc-c++......
  • 每当有人问我数据不均衡的处理时候,我推荐他使用smote
    见:https://github.com/IBM/xgboost-smote-detect-fraud/blob/master/notebook/Fraud_Detection.ipynb 可以看到在不使用smote前,召回率和精度都不好(对恶意样本),使用了smote做数据增强后,两个指标都好了很多。 ......
  • Nginx配置文件
    nginx配置文件详解```安装完了之后,后续nginx的所有功能,都是围绕着修改nginx配置文件生效了看懂配置文件,运维来说,达到手写nginx配置文件,才是合格的。```通过官网yum仓库默认安装的nginx.confusernginx;worker_processesauto;error_log/var/log/nginx/error.lognot......