特别申明:内容出自《跟老男孩学Linux:Web集群实战》
文章目录
[root@lb01 etc]# cat /application/nginx/conf/nginx.conf
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile off;
keepalive_timeout 65;
upstream static_pools{
server 192.168.55.9:80 weight=1;
}
upstream upload_pools{
server 192.168.55.10:80 weight=1;
}
upstream default_pools{
server 192.168.55.11:80 weight=1;
}
server {
listen 80;
server_name www.etiantian.org;
location / {
if ($http_user_agent ~* "MSIE")
#如果请求的浏览器为微软IE浏览器(MSIE),则让请求由static_pools池处理
{
proxy_pass http://static_pools;
}
if ($http_user_agent ~* "Chrome")
#如果请求的浏览器为谷歌浏览器(Chrome),则让请求由upload_pools池处理
{
proxy_pass http://upload_pools;
}
proxy_pass http://default_pools;
#其他客户端,由default_pools处理
include proxy.conf;
}
}
参考文献
[1] 老男孩. 跟老男孩学Linux:Web集群实战[M]. 机械工业出版社,2016-03-01.