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来解决这个问题

nginx学习http_access_module模块

 

 2. 结合geo模块

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

 

相关文章:

  • 2022-12-23
  • 2021-12-16
  • 2021-04-01
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-19
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-29
  • 2021-08-28
  • 2021-07-31
相关资源
相似解决方案