欧美一级色视频,簧片在线免费看,美日韩在线,成人观看网站a,亚洲欧美在线一区二区,欧美操穴,欧美综合专区

龍巖易富通網(wǎng)絡(luò)科技有限公司

龍巖小程序開發(fā),龍巖分銷系統(tǒng)

debian系統(tǒng)寶塔nginx配置geoip2屏蔽國(guó)家訪問

2025.10.31 | 376閱讀 | 0條評(píng)論 | 通用代碼

一:安裝geoip2依賴擴(kuò)展

sudo apt install libmaxminddb-dev -y


二:下載ngx_http_geoip2_module

git clone https://github.com/leev/ngx_http_geoip2_module.git


三:在寶塔面板里邊安裝nginx的時(shí)候選擇編譯安裝,并手動(dòng)增加擴(kuò)展,安裝時(shí)候點(diǎn)擊啟用

模塊名稱 ngx_http_geoip2_module

模塊說明 禁用國(guó)家ip

模塊參數(shù) --add-module=/path/to/ngx_http_geoip2_module

等待安裝后輸入 nginx -V 查看是否安裝成功


四:在寶塔中安裝geoip

配置nginx

在nginx配置文件中,http段加入以下代碼。以寶塔安裝的nginx為例,打開/www/server /nginx/conf/nginx.conf文件,

在http中添加


geoip2 /usr/share/GeoIP/Country.mmdb {

    $geoip2_data_country_code country iso_code;

}

map $geoip2_data_country_code $allowed_country {

    default yes;

    CN yes;

    JP no;

    DE no;

}


在站點(diǎn)配置文件添加:

if ($allowed_country = no) {

    return 403;

}


贊 (

發(fā)表評(píng)論

大厂| 洛南县| 永吉县| 怀化市| 平山县| 五华县| 平和县| 陆河县| 德江县| 浦城县| 廉江市| 梓潼县| 陆丰市| 抚松县| 余姚市| 钦州市| 苗栗县| 祁门县| 贡觉县| 大安市| 工布江达县| 宕昌县| 金沙县| 陇川县| 武山县| 慈利县| 宜城市| 博客| 页游| 长春市| 习水县| 简阳市| 崇明县| 来安县| 太谷县| 布尔津县| 西平县| 镇远县| 青阳县| 阳东县| 邢台市|