Nginx的upstream模块
1.相关配置 upstream模块的典型应用是反向代理,这里就以ngx_http_proxy_module模块为例。假定我们有如下这样的实例环境,客户端对服务器80端口的请求都被Nginx Proxy Server转发到另外两个真实的Nginx Web Server实例上进行处理(下图是实验环境,Web Server和Proxy Server都只是Nginx进程,并且运行在同一台服务器): 那么,Nginx Proxy Server的核心配置多半是这样: 123456789101112131415161718 Filename : nginx.conf …http { … upstream load_balance { server localhost:8001; server localhost:8002; } server { listen 80; location / { proxy_buffering off; proxy_pass http://load_balance; } } } 上面的 proxy_buffering off; 配置是为了禁用nginx反向代理的缓存功能,保证客户端的每次请求都被转发到后端真实服务器,以便我们每次跟踪分析的nginx执行流程更加简单且完整。而另外两个配置命令upstream和proxy_pass在此处显得更为重要