`
corbe
  • 浏览: 7806 次
  • 来自: ...
最近访客 更多访客>>
社区版块
存档分类
最新评论

nginx 负载均衡 ngx_http_upstream

阅读更多
例子1:-------------------------
upstream  backend  {
    server   backend1.example.com       weight=5;
    server   backend2.example.com:8080;
    server   unix:/tmp/backend3;
}

server {
    location / {
        proxy_pass  http://backend;
    }
}


例子2:-----------------------------
http {
    upstream myproject {
        server 127.0.0.1:8000 weight=3;
        server 127.0.0.1:8001;
        server 127.0.0.1:8002;   
        server 127.0.0.1:8003;
    }

    server {
        listen 80;
        server_name www.domain.com;
        location / {
            proxy_pass http://myproject;
        }
    }
}



例子3:-----------------------------
upstream sitename {
server 127.0.0.1:4000;
server 127.0.0.1:4001;
}

server {
listen 80;
server_name www.sitename.com;
rewrite ^(/.*) http://sitename.com$1 permanent;
}

server {
listen 80;
server_name sitename.com;
location / {
proxy_pass http://sitename;
}
}
分享到:
评论

相关推荐

    ngx_dynamic_upstream:Nginx的动态上游

    ngx_dynamic_upstream ngx_dynamic_upstream是用于使用等HTTP API动态地操作上游的模块。要求ngx_dynamic_upstream在upstream上下文中需要zone指令。 该指令在nginx-1.9.0-plus中可用。地位生产准备就绪。指令...

    lua-upstream-nginx-module, Nginx C 模块将Lua向ngx_lua公开,用于 Nginx upstreams.zip

    lua-upstream-nginx-module, Nginx C 模块将Lua向ngx_lua公开,用于 Nginx upstreams 电子邮件名称ngx_http_lua_upstream - Nginx MODULE,用于向 Nginx upstreams公开Lua到 ngx_lua目录NAME状态概要说明函数get_...

    ngx_http_upstream_keepalive-d9ac9ad67f45.tar.gz

    nginx upstream 连接池 ngx_http_upstream_keepalive-d9ac9ad67f45.tar.gz

    nginx_upstream_check_module-master.zip

    nginx自带是没有针对负载均衡后端节点的健康检查的,但是可以通过默认自带的ngx_http_proxy_module 模块和ngx_http_upstream_module模块中的相关指令来完成当后端节点出现故障时,自动切换到健康节点来提供访问。

    ngx_http_upstream_ip_hash_module.c

    nginx的iphash改成按照ip轮询

    nginx-1.24.0-2.el7.x86-64.rpm

    、limit_conn_module、ngx_http_limit_req_module、ngx_http_access_module、ngx_http_auth_basic_module、ngx_http_fastcgi_module、ngx_http_gzip_module、ngx_http_proxy_module、ngx_http_upstream_module、ngx_...

    Openresty_For_Windows_1.7.10.zip

    ngx_lua_upstream headers-more-nginx-module rds-json-nginx-module nginx-http-concat-module redis2-nginx-module and these C module for Lua: 以及这些用于 Lua 的 C 模块: lua-cjson lua-redis-parser lua-...

    nginx负载均衡配置,宕机自动切换方式

    严格来说,nginx自带是没有针对负载均衡后端节点的健康检查的,但是可以通过默认自带的ngx_http_proxy_module模块和ngx_http_upstream_module模块中的相关指令来完成当后端节点出现故障时,自动切换到健康节点来提供...

    lua-upstream-nginx-module:Nginx C模块将Lua API公开给Nginx上游的ngx_lua

    ngx_http_lua_upstream-Nginx C模块将Lua API公开给Nginx上游的ngx_lua 目录 状态 该模块已准备就绪。 概要 http { upstream foo.com { server 127.0.0.1 fail_timeout=53 weight=4 max_fails=100; server ...

    nginx-sticky-module-1.25.zip

    nginx sticky是nginx的module,可以实现基于cookie的负载均衡。 下载后,在编译安装nginx时,用--add-module选项,指到sticky所在目录。类似命令如下: ./configure --prefix=/usr/local/nginx-1.6.0 --add-module=...

    使用nginx做负载均衡的模块解读

    nginx 的负载均衡功能依赖于 ngx_http_upstream_module模块,所支持的代理方式有 proxy_pass(一般用于反向代理),fastcgi_pass(一般用于和动态程序交互),memcached_pass,proxy_next_upstream,fastcgi_next_pass,...

    ngx_http_dyups_module:[WIP]通过静态界面更新上游的配置

    此模块可用于更新您的上游列表,而无需重新加载Nginx。 目录 变更记录 版本V0.2.9 版本V0.2.8 版本V0.2.7 版本V0.2.6 版本V0.2.5 版本V0.2.4 版本V0.2.2 发行版V0.2.0 兼容性 Tengine相容性 模块兼容性 运行...

    nginx_log_analysis:nginx日志分析

    本代码设计思路没有变化,但代码是3年前的了,看上去不太利索,最近半年已经有引入了更高性能的代码和流转数据的流程,等时间空了在开放出来。 nginx_log_analysis nginx_log_analysis是一个...3、支持upstream_tim

    docker-ngx_dynamic_upstream

    docker-ngx_dynamic_upstream docker run -d -v /path/to/nginx.conf:/nginx/conf/nginx.conf:ro mashiro/ngx_dynamic_upstream

    重新编译的 nginx,支持 内容替换 主动后端检查

    集成了第三方包: nginx_upstream_check_module 主动后端检查, ngx_http_substitutions_filter 内容替换, set-misc-nginx-module-0.33 url 中解码,ngx_devel_kit-0.3.2 misc 依赖

    opt.tar.gz

    nginx1.12适配的 lua 模块 ngx_dynamic_upstream 模块 ngx_http_dyups_module

    nginx 主动健康检测支持udp和https功能版本

    在tengine的ngx_http_upstream_check_module的基础上增加了udp检测和https检测的功能。目前只能在tengine上面跑,如果需要在官方nginx上跑,需要修改nginx的负载均衡模块的部分代码

    rds-json-nginx-module:一个Nginx输出过滤器,用于将ngx_drizzle等生成的Resty DBD流格式化为JSON

    姓名ngx_rds_json-将ngx_drizzle等生成的Resty DBD流格式化为JSON的输出过滤器目录状态该模块被认为可以投入生产。 我们需要你的帮助! 如果您发现此模块有用和/或有趣,请考虑加入开发! 提交位可以根据您的要求...

Global site tag (gtag.js) - Google Analytics