惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

MyScale Blog
MyScale Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
阮一峰的网络日志
阮一峰的网络日志
罗磊的独立博客
博客园 - 叶小钗
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
美团技术团队
酷 壳 – CoolShell
酷 壳 – CoolShell
雷峰网
雷峰网
宝玉的分享
宝玉的分享
大猫的无限游戏
大猫的无限游戏
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Last Week in AI
Last Week in AI
爱范儿
爱范儿
小众软件
小众软件
K
Kaspersky official blog
P
Proofpoint News Feed
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - Franky
V
Vulnerabilities – Threatpost
博客园_首页
Microsoft Security Blog
Microsoft Security Blog
C
Cybersecurity and Infrastructure Security Agency CISA
V
V2EX
C
Check Point Blog
S
Schneier on Security
P
Palo Alto Networks Blog
IT之家
IT之家
GbyAI
GbyAI
T
Threat Research - Cisco Blogs
Hugging Face - Blog
Hugging Face - Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Apple Machine Learning Research
Apple Machine Learning Research
C
Cyber Attacks, Cyber Crime and Cyber Security
T
Tailwind CSS Blog
Project Zero
Project Zero
Y
Y Combinator Blog
V
Visual Studio Blog
Simon Willison's Weblog
Simon Willison's Weblog
T
Threatpost
Scott Helme
Scott Helme
L
LINUX DO - 热门话题
S
Securelist
C
CERT Recently Published Vulnerability Notes
A
Arctic Wolf
M
MIT News - Artificial intelligence
人人都是产品经理
人人都是产品经理

博客园 - 紫色物语

docker相关知识 spring boot+mybatis 系列 springboot+dockfile @log的decorator完美实现(原创) 配置nginx输入任何地址都跳转至维护页面 0005python中的静态方法和类方法 0004python中的map,reduce,lambda,filter 0003python中的可变参数 0000python中文乱码解决方案 0002python中dict和list的特殊构造 0001python中特殊的for迭代zip函数 年度热门开源项目 SSO 不同服务器数据库之间的数据操作 自动构建部署 - 紫色物语 EF 性能调优 断点续传 gis 相关资料 easyui 特殊操作
多个nginx之间如何实现反向代理和负责均衡
紫色物语 · 2019-09-28 · via 博客园 - 紫色物语

1)nginx反向代理:

http {

    upstream routeadmin {

        ip_hash;

        server 127.0.0.1:9201 weight=5;

        server 127.0.0.1:9202 weight=5;

    }

    server {

        listen       80;

        server_name  localhost;

        location /route/admin {

            proxy_pass http://routeadmin;

        }

    }

}

2)以nginx承载前端-负载1:

http {

    include       mime.types;

    default_type  application/octet-stream;

    server {

        listen       9201;

        server_name  localhost;

        location / {

            root   html;

            index  index.html index.htm;

        }

        location /route/admin {

            proxy_pass http://127.0.0.1:9201/;

        }

    }

}

3)以nginx承载前端-负载2:

http {

    include       mime.types;

    default_type  application/octet-stream;

    server {

        listen       9202;

        server_name  localhost;

        location / {

            root   html;

            index  index.html index.htm;

        }

        location /route/admin {

            proxy_pass http://127.0.0.1:9202/;

        }

    }

}

4)nginx内置全局变量

$args :这个变量等于请求行中的参数,同$query_string

$content_length : 请求头中的Content-length字段。

$content_type : 请求头中的Content-Type字段。

$document_root : 当前请求在root指令中指定的值。

$host : 请求主机头字段,否则为服务器名称。

$http_user_agent : 客户端agent信息

$http_cookie : 客户端cookie信息

$limit_rate : 这个变量可以限制连接速率。

$request_method : 客户端请求的动作,通常为GET或POST。

$remote_addr : 客户端的IP地址。

$remote_port : 客户端的端口。

$remote_user : 已经经过Auth Basic Module验证的用户名。

$request_filename : 当前请求的文件路径,由root或alias指令与URI请求生成。

$scheme : HTTP方法(如http,https)。

$server_protocol : 请求使用的协议,通常是HTTP/1.0或HTTP/1.1。

$server_addr : 服务器地址,在完成一次系统调用后可以确定这个值。

$server_name : 服务器名称。

$server_port : 请求到达服务器的端口号。

$request_uri : 包含请求参数的原始URI,不包含主机名,如:”/foo/bar.php?arg=baz”。

$uri : 不带请求参数的当前URI,$uri不包含主机名,如”/foo/bar.html”。

$document_uri : 与$uri相同。