环境根据http://www.cnblogs.com/zzzhfo/p/6032095.html配置

修改LB的/usr/local/nginx/conf/nginx.conf

upstream static_pools {
server 192.168.119.130:;
}
upstream dynamic_pools {
server 192.168.119.133:;
} server {
listen ;
server_name www.test.com;
location / {
root html;
index index.html index.htm;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
if ($http_user_agent ~* "MSIE") #MSIE IE浏览器
{
proxy_pass http://dynamic_pools;
}
if ($http_user_agent ~* "Firefox") #Firefox火狐浏览器
{
proxy_pass http://static_pools;
}
}

在web01和web02上分别创建一个测试页

web01

[root@web01 www]# echo Firefox > test.html

web02

[root@web02 www]# echo "IE" > test.html 

测试、分别使用Firefox和IE浏览器访问

Firefox访问(物理机没有做hosts解析使用LB的IP访问)

查看日志

web01

[root@web01 www]# tail -f /etc/httpd/logs/www.test.com.access_log
"192.168.119.1" - - [/Oct/::: +] "GET /favicon.ico HTTP/1.0" "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:49.0) Gecko/20100101 Firefox/49.0"
"192.168.119.1" - - [/Oct/::: +] "GET /test.html HTTP/1.0" "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:49.0) Gecko/20100101 Firefox/49.0"
"192.168.119.1" - - [/Oct/::: +] "GET /test.html HTTP/1.0" "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:49.0) Gecko/20100101 Firefox/49.0"
"192.168.119.1" - - [/Oct/::: +] "GET /test.html HTTP/1.0" - "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:49.0) Gecko/20100101 Firefox/49.0"
"192.168.119.1" - - [/Oct/::: +] "GET /test.html HTTP/1.0" - "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:49.0) Gecko/20100101 Firefox/49.0"
"192.168.119.1" - - [/Oct/::: +] "GET /test.html HTTP/1.0" - "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:49.0) Gecko/20100101 Firefox/49.0"
"192.168.119.1" - - [/Oct/::: +] "GET /test.html HTTP/1.0" - "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:49.0) Gecko/20100101 Firefox/49.0"
"192.168.119.1" - - [/Oct/::: +] "GET /test.html HTTP/1.0" - "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:49.0) Gecko/20100101 Firefox/49.0"
"192.168.119.1" - - [/Oct/::: +] "GET /test.html HTTP/1.0" - "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:49.0) Gecko/20100101 Firefox/49.0"
"192.168.119.1" - - [/Oct/::: +] "GET /test.html HTTP/1.0" - "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:49.0) Gecko/20100101 Firefox/49.0"

web02

[root@web02 www]# tail -f /etc/httpd/logs/www.test.com.access_log
"192.168.119.136" - - [/Oct/::: +] "GET /test.html HTTP/1.0" - "-" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)"
"192.168.119.136" - - [/Oct/::: +] "GET /test.html HTTP/1.0" - "-" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)"
"192.168.119.136" - - [/Oct/::: +] "GET /test.html HTTP/1.0" - "-" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)"
"192.168.119.136" - - [/Oct/::: +] "GET /test.html HTTP/1.0" - "-" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)"
"192.168.119.136" - - [/Oct/::: +] "GET /test.html HTTP/1.0" - "-" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)"
"192.168.119.136" - - [/Oct/::: +] "GET /test.html HTTP/1.0" - "-" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)"
"192.168.119.136" - - [/Oct/::: +] "GET /test.html HTTP/1.0" - "-" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)"
"192.168.119.136" - - [/Oct/::: +] "GET /test.html HTTP/1.0" - "-" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)"
"192.168.119.136" - - [/Oct/::: +] "GET /test.html HTTP/1.0" "-" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)"
"192.168.119.136" - - [/Oct/::: +] "GET /test.html HTTP/1.0" - "-" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)"

nginx反向代理、根据浏览器分离访问的更多相关文章

  1. Nginx 反向代理功能-动静分离

    Nginx 反向代理功能-动静分离 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任.

  2. nginx反向代理(动静分离)

    使用反向代理(动静分离)可以让nginx专注静态内容,把动态请求交给apache来处理,发挥各自的优势,而且整个架构更加清晰: 这里假设你已经搭建好了nginx环境; 为了简单起见,就不用源码编译安装 ...

  3. nginx反向代理前后端分离项目(后端多台)

    目前软件架构都比较流行前后端分离,前后端的分离也实现了前后端架构的分离,带来的好处 —— 整个项目的开发权重往前移,实现真正的前后端解耦,动态资源和静态资源分离,提高了性能和扩展性. 通常Spring ...

  4. Nginx反向代理之动静分离

    我们已经知道了什么是正向代理与反向代理,这次我们就讲一下Nginx的动静分离的案例,其实质运用的就是反向代理,专门用一台服务器代理服务器上的图片资源. 想使用代理必然要配置代理,配置反向代理,必须要用 ...

  5. nginx反向代理、动静分离

    环境:根据http://www.cnblogs.com/zzzhfo/p/6032095.html配置 方法一:根据目录实现动静分离 在web01创建image并上传一张图片作为静态页面 [root@ ...

  6. nginx反向代理tomcat访问时浏览器加载失败,出现 ERR_CONTENT_LENGTH_MISMATCH 问题

    问题说明:测试机上部署了一套业务环境,nginx反向代理tomcat,在访问时长时间处于加载中,十分缓慢! 通过浏览器调试(F12键->Console),发现有错误ERR_CONTENT_LEN ...

  7. nginx反向代理vue访问时浏览器加载失败,出现 ERR_CONTENT_LENGTH_MISMATCH 问题

    问题说明:测试机上部署了一套业务环境,nginx反向代理tomcat,在访问时长时间处于加载中,十分缓慢! 通过浏览器调试(F12键->Console),发现有错误ERR_CONTENT_LEN ...

  8. Nginx反向代理+负载均衡简单实现(http方式)

    1)nginx的反向代理:proxy_pass2)nginx的负载均衡:upstream 下面是nginx的反向代理和负载均衡的实例: 负载机:A机器:103.110.186.8/192.168.1. ...

  9. nginx 反向代理 负载均衡

    nginx反向代理 用户(浏览器) 请求网站资源 -> 直接定位到django后台(所有的请求压力,都直接给了后台) django默认对并发性 很差,并且处理网页的静态资源,效率很差 10万个并 ...

  10. Nginx反向代理的简单实现

    1)nginx的反向代理:proxy_pass2)nginx的负载均衡:upstream 下面是nginx的反向代理和负载均衡的实例: 负载机:A机器:103.110.186.8/192.168.1. ...

随机推荐

  1. HTML5学习总结-04 音频&视频播放

    一 音频播放 1 Audio(音频) HTML5提供了播放音频文件的标准 2 control(控制器) control属性攻添加播放,暂停和音量空间. 3 标签定义声音 <audio> 例 ...

  2. Linux环境下发布项目(Tomcat重新启动)

    在Linux系统下,重启Tomcat 首先,进入Tomcat下的bin目录 cd /usr/local/tomcat/bin 使用Tomcat关闭命令 ./shutdown.sh 查看Tomcat是否 ...

  3. mysql修改引擎

    1 查看系统支持的存储引擎 show engines; 2 查看表使用的存储引擎 两种方法: a.show table status from db_name where name='table_na ...

  4. e_msg_c_gs_enter_gs_req

    e_msg_c_gs_enter_gs_req 就是到GS上验证客户端发送的token是否存在,如果存在返回成功,并把该token删除

  5. python 五子棋

    http://www.skywind.me/blog/archives/1029 http://blog.csdn.net/skywind/article/details/8164713 https: ...

  6. C# 判断 当前设备的IP地址、默认网关、子网掩码在不在同一网段内

    要判断两个IP地址是不是在同一个网段,就将它们的IP地址分别与子网掩码做与运算,得到的结果一网络号,如果网络号相同,就在同一子网,否则,不在同一子网. 例:假定选择了子网掩码255.255.254.0 ...

  7. Ubuntu下安装了java但启动eclipse报错说没装java

    参考资料:http://blog.csdn.net/happyteafriends/article/details/8290950 一.问题 在Ubuntu下安装了java并在~/.bashrc配置了 ...

  8. Game Programming Pattern

    http://gameprogrammingpatterns.com/contents.html

  9. C++ Reflection

    http://www.vollmann.com/en/pubs/meta/meta/meta.html http://www.extreme.indiana.edu/reflcpp/ http://w ...

  10. clearInterval,setInterval,clearTimeout,setTimeout

    setInterval("f()",1000)  每隔1秒就执行一次f() clearInterval   关闭clearInterval setTimeout("f() ...