nginx学习http_access_module模块

 

 

 location ~ ^/1.html {
        root   /opt/app/code;
        deny XXXXX;  #这个ip不能访问1.html
        allow all;   		  #其他的可以访问这个页面1.html
        index  index.html index.htm;
    }


location ~ ^/1.html {
	root   /opt/app/code;
	allow XXXXX;  #这个ip能访问1.html
	deny all;              #其他的不可以访问这个页面1.html
	index  index.html index.htm;
}

  局限性,如下图第一个所示,如果客户端通过一个代理,访问服务端,服务端获取的是代理的ip,而不是客户端的ip,

  1.其中一个解决方式使用http_x_forwarded_for来解决这个问题

 

 2. 结合geo模块

3.  通过http自定义变量传参数

 

posted @ 2017-10-30 22:25  spectrelb  阅读(1346)  评论(0编辑  收藏  举报