查看: 308|回复: 27

通过CLOUDFLARE屏蔽国家代码。

[复制链接]

120

主题

316

回帖

1072

积分

金牌会员

积分
1072
发表于 2016-11-6 22:27:19 | 显示全部楼层 |阅读模式
本帖最后由 a276229381 于 2016-11-7 02:36 编辑

非常感谢牛人 @DeepSkyFire   问题已经解决。。我在网上搜了半年了。。没有解决办法。希望给后来的人有帮助。
回复

使用道具 举报

105

主题

364

回帖

1073

积分

金牌会员

积分
1073
发表于 2016-11-6 22:29:10 | 显示全部楼层


CN=404
us=404
回复

使用道具 举报

120

主题

316

回帖

1072

积分

金牌会员

积分
1072
 楼主| 发表于 2016-11-6 22:40:00 | 显示全部楼层

空气 发表于 2016-11-6 22:49

http://nginxlibrary.com/using-cloudflare-for-country-blocking/

我就是按照这个方法设置的。。conf文件。。。但是不行的。。。还是可以访问。。国内IP。 请问是哪里错了?

难道是NGINX  MAP模块 没有安装?
回复

使用道具 举报

120

主题

316

回帖

1072

积分

金牌会员

积分
1072
 楼主| 发表于 2016-11-6 22:40:00 | 显示全部楼层

guyusoftware 发表于 2016-11-7 00:53

Note: You must retrieve the IP Geolocation information from the CF-IPCountry HTTP header.
文章裡的 ...

我把    map $http_cf_ipcountry $allow {   改为 cf_ipcountry  一样屏蔽不了哇。。大神
  
回复

使用道具 举报

486

主题

5574

回帖

1万

积分

论坛元老

积分
12788
发表于 2016-11-6 22:40:28 | 显示全部楼层
cloudflare升$200可破,直接设置即可。
回复

使用道具 举报

486

主题

5574

回帖

1万

积分

论坛元老

积分
12788
发表于 2016-11-6 22:40:44 | 显示全部楼层
https://support.cloudflare.com/hc/en-us/articles/200170986-How-does-CloudFlare-handle-HTTP-Request-headers-

[ol]
  • Fourth Exception: CF-IPCountry
  • This header holds the country code of the originating visitor, it is a two character value that will have the Country code, if the country code is unknown, it will be "XX".
  • "Cf-Ipcountry: US"[/ol]复制代码
  • 回复

    使用道具 举报

    120

    主题

    316

    回帖

    1072

    积分

    金牌会员

    积分
    1072
     楼主| 发表于 2016-11-6 22:49:00 | 显示全部楼层
    我是WDCP  我修改的  www/wdlinux/nginx/conf/vhost/www.123.com.conf


    配置文件如下:

    server {
            listen       80;
            root /www/web/123_com/public_html;
            server_name 123.com;
            index  index.html index.php index.htm;
            error_page  400 /errpage/400.html;
            error_page  403 /errpage/403.html;
            error_page  404 /errpage/4041.html;
            error_page  503 /errpage/503.html;
            location ~ \.php$ {
                    proxy_pass http://127.0.0.1:88;
                    include naproxy.conf;
            }
            location ~ /\.ht {
                    deny  all;
            }
            location / {
                    try_files $uri @apache;
            }
            location @apache {
                     proxy_pass http://127.0.0.1:88;
                     include naproxy.conf;
            }  

         map $http_cf_ipcountry $allow {
            default yes;
            CN no;
            MX no;
            NO no;
    }

         if ($allow = no) {
        return 403;
    }



       
    }


            
            
            
            
            
            
            
            
            
            
            
            
            
            
            请问为什么国内IP 还是可以访问呢?
    回复

    使用道具 举报

    0

    主题

    1

    回帖

    4

    积分

    新手上路

    积分
    4
    发表于 2016-11-6 22:49:00 | 显示全部楼层
    本帖最后由 ruxiu 于 2016-11-6 23:49 编辑

    62900015 发表于 2016-11-6 22:40

    cloudflare升$200可破,直接设置即可。


    https://www.cloudflare.com/plans/pro/#compare-features

    只有最高挡的版本才有
    五千美金一个月
    官方页面说的很清楚

    https://support.cloudflare.com/hc/en-us/articles/200170326-How-much-does-the-Enterprise-Plan-cost-

    用DNS解析屏蔽算么
    回复

    使用道具 举报

    45

    主题

    972

    回帖

    2119

    积分

    金牌会员

    积分
    2119
    发表于 2016-11-6 22:49:26 | 显示全部楼层
    http://nginxlibrary.com/using-cloudflare-for-country-blocking/
    回复

    使用道具 举报

    120

    主题

    316

    回帖

    1072

    积分

    金牌会员

    积分
    1072
     楼主| 发表于 2016-11-6 22:49:46 | 显示全部楼层

    62900015 发表于 2016-11-6 22:40

    cloudflare升$200可破,直接设置即可。

    。。。。要升级到专业版才行 就是价格面谈那个。。。  几百个IP 至于开那么高嘛。

    明显不划算。也开不起。。。通过国家代码 既便宜 又简单。  你会弄吗

    我修改了www/wdlinux/nginx/conf/vhost/www.XXX.com.conf  这个里面的CONF文件。。但是无效。

    刷新了之后 国内IP依然可以访问。。

    回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    关注公众号

    相关侵权、举报、投诉及建议等,请发 E-mail:admin@discuz.vip

    Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

    在本版发帖
    关注公众号
    返回顶部