nginx正向代理反向代理

正向代理:代理对象是客服端
反向代理:代理对象是服务端
区别所代理的对象不一样

#配置语法Syntax: proxy_pass URL;Default:-ContextLlocation,if in location,limit_except
#配置#192.168.0.250 (代理服务器)resolver 8.8.8.8;location / {    #default_type text/html;    #return 200 http_host:$http_host<br>request_uri:$request_uri;    proxy_set_header X-Forwarded-For 250.cn;    proxy_pass http://$http_host$request_uri;}#192.168.0.251location / {    default_type text/html;if ($http_x_forwarded_for != "250.cn" ){        return 200 http_x_forwarded_for:$http_x_forwarded_for;     }    index  index.html index.htm;    autoindex on;    autoindex_exact_size off;    autoindex_localtime on;    }

本地访问
http://251.cn/
客户端设置250的代理(chrome可通过SwitchySharp)
才能真正访问到

/http:http:http:http: cannot have URI part  location given by regular expression, or inside named location, or inside  statement, or inside  block  /usr/local/nginx/conf/nginx.conf:

待续.....

 

©著作权归作者所有:来自51CTO博客作者hkui2010的原创作品,如需转载,请注明出处,否则将追究法律责任

更多相关文章

  1. 部分无公网环境下使用yum源代理
  2. 换IP
  3. LNMP架构应用实战—Nginx反向代理负载均衡配置
  4. 模拟器如何换IP
  5. Apache服务的反向代理及负载均衡配置
  6. Nginx架构详解(二):nginx反向代理配置
  7. 反向代理服务器:为什么用,怎么用,如何用?
  8. nginx反向代理443端口
  9. 前端用Ajax实现数据异步加载,无刷新分页(核心思路为 事件派发+事件

随机推荐

  1. 记录Golang Recover的一个小坑
  2. 哪些大公司在用go语言
  3. go是什么开发语言
  4. Go语言属于什么语言
  5. go语言常用命令有哪些
  6. go语言有引用传递么
  7. go语言如何导入包
  8. go语言如何改变回显颜色
  9. go语言用什么ide
  10. go语言有什么特点?