HTTP协议 包头分析
原创
©著作权归作者所有:来自51CTO博客作者AndyBrave的原创作品,请联系作者获取转载授权,否则将追究法律责任
-----------------06 王梦楠——————————————————
listen 80;
server_name www.wmn.com;
location / {
root /tmp/www;
index index.html index.htm;
}
error_page 404 /404.html;
location = /404.html {
root /tmp/404;
}
在Nginx 这个站点 此代码 基于HTTP协议是域名 (host)头 进行分发
listen 80;
server_name 192.168.2.2;
location / {
root /tmp/www;
index index.html index.htm;
}
error_page 404 /404.html;
location = /404.html {
root /tmp/404;
}
此代码 基于HTTP协议是IP (host)头 进行分发
server_name www.wmn.com;
location / {
root /tmp/www;
index index.html index.htm;
}
location ~ \.php$ {
proxy_pass http://192.168.2.4;
}
location ~ \.jsp$ {
proxy_pass http://192.168.2.2:8080;
}
error_page 404 /404.html;
location = /404.html {
root /tmp/404;
}
此代码 基于HTTP协议是 URI 头 进行分发 同时使用反向代理
listen 80;
server_name www.wmn1.com;
location / {
proxy_pass http://192.168.2.2:8080;
}
}
反向代理 如果人家访问 www.wmn1.com 这台服务器 会找 ip 为192.168.2.2:8080 这台服务器 处理
如果服务器 访问客户端 就是正想代理
server {
listen 80;
server_name www.wmn1.com;
location / {
proxy_pass http://192.168.2.2:8080;
if ($http_user_agent ~ MSIE ) {
proxy_pass http://192.168.2.4;
}
}
此代码 基于HTTP协议 浏览器类型头 进行分发
未完待续
to be continued.............!!!!!!!!!
上一篇:关于配置论坛
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
Java实现HTTP:HTTP数据包头部格式解读1
HTTP协议的大部分功能其实通过其协议包头来实现。因为HTTP协议包头作用如
http java 客户端 缓存 服务器