欧美高清视频一区,亚洲福利视频,国产精品自产拍在线观看桃花,国产精品自产拍在线观看桃花,久久国产三级,一区二区三区日韩在线,影音先锋日本

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

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

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

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

一:安裝geoip2依賴擴展

sudo apt install libmaxminddb-dev -y


二:下載ngx_http_geoip2_module

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


三:在寶塔面板里邊安裝nginx的時候選擇編譯安裝,并手動增加擴展,安裝時候點擊啟用

模塊名稱 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;

}


在站點配置文件添加:

if ($allowed_country = no) {

    return 403;

}


贊 (

發(fā)表評論

民县| 文成县| 广汉市| 克山县| 龙海市| 伊宁县| 刚察县| 双流县| 中卫市| 达尔| 乌拉特中旗| 唐河县| 石城县| 辉县市| 新平| 隆德县| 彭泽县| 隆化县| 大厂| 桃园县| 兴义市| 赣榆县| 塔河县| 新兴县| 建水县| 乐清市| 桑植县| 铜山县| 重庆市| 农安县| 灵武市| 江口县| 宁武县| 岢岚县| 浮梁县| 泌阳县| 平远县| 会东县| 大田县| 道孚县| 宜阳县|