happyxhw101's recent timeline updates
happyxhw101

happyxhw101

V2EX member #636021, joined on 2023-06-27 11:27:03 +08:00
Per happyxhw101's settings, the topics list is hidden
Deals info, including closed deals, is not hidden
happyxhw101's recent replies
Nov 14, 2025
Replied to a topic by fcfangcc NAS 有人试过把 NAS 文件备份到对象存储吗
我是加密上传到百度网盘,自己写了个程序,增量上传,文件不变就不会上传
Aug 6, 2025
Replied to a topic by chanlk 程序员 感叹: DDIA 真是一本好书
Aug 6, 2025
Replied to a topic by chanlk 程序员 感叹: DDIA 真是一本好书
DDIA -》数据密集型应用系统设计 ?
Jul 18, 2025
Replied to a topic by SoulFlame 问与答 请教如何方便有效的封禁国外 IP
tcp 也是可以的,用 nginx 的 stream, 比如代理 ssh
```
map $allowed $ssh_server {
yes ssh;
}

upstream ssh {
server 192.168.5.1:12345;
}

server {
listen 2345;
listen [::]:2345;
proxy_pass $ssh_server;
proxy_connect_timeout 30s;
proxy_timeout 60s;

ssl_preread on;
}
```
Jul 18, 2025
Replied to a topic by SoulFlame 问与答 请教如何方便有效的封禁国外 IP
@happyxhw101 写错了
map $geoip_country_code $allowed_country {
default no;
CN yes;
}
Jul 18, 2025
Replied to a topic by SoulFlame 问与答 请教如何方便有效的封禁国外 IP
如果用的是 nginx 代理,可以这么干

1. nginx 配置 geo-ip
```
load_module "modules/ngx_http_geoip_module.so";
load_module "modules/ngx_stream_geoip_module.so";
```

2. 映射国家 code
```
map $geoip_country_code $allowed_country {
default yes;
CN yes;
}

map $remote_addr $allowed {
default $allowed_country;
127.0.0.1 yes;
~^192\.168\.\\d+\.\\d+$ yes;
~^192\.167\.0\.\\d+$ yes;
~^192\.166\.1\.\\d+$ yes;
}
```

3. 判断 allowed
```
server {
listen 443 ssl;
if ($allowed != yes) {
return 404;
}
}
```
About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   975 Online   Highest 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 30ms · UTC 19:32 · PVG 03:32 · LAX 12:32 · JFK 15:32
♥ Do have faith in what you're doing.