我使用Nginx和GeoIP来阻止某些国家(到整个网站)。
是否可以阻止一个特定的目录?
这条路:
www.domain.com/
人人都可以访问
www.domain.com/ ES
只有西class牙的IP可以访问,没有其他人。
www.domain.com/ 其他
除中国外, 每个人都可以使用OTHER
(国家只是作为一个例子)
谢谢。
是的,我知道GeoIP并不总是准确的,但是帮助很大。
使用ngx_http_access_module和ngx_http_geo_module 。
location /ES { # Enter the Allowed IP blocks allow xxxx; deny all; } location /OTHER { # Enter the Denied IP blocks deny xxxx; allow all; }
资源:
http://nginx.org/en/docs/http/ngx_http_access_module.html http://nginx.org/en/docs/http/ngx_http_geo_module.html