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

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

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

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

2025.10.31 | 442閱讀 | 0條評論 | 通用代碼

一:安裝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

模塊說明 禁用國家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ā)表評論

佳木斯市| 玉田县| 邹平县| 英超| 进贤县| 阿巴嘎旗| 尉氏县| 曲松县| 桐庐县| 黄大仙区| 大英县| 平昌县| 商都县| 甘肃省| 余姚市| 米泉市| 文化| 西宁市| 鄂州市| 宁德市| 麻栗坡县| 炉霍县| 博兴县| 诸城市| 应用必备| 衡阳市| 巢湖市| 静海县| 延边| 卢湾区| 玉门市| 闵行区| 宣化县| 金塔县| 晋州市| 绵竹市| 娱乐| 环江| 南丹县| 香河县| 子长县|