去年搭建个人导航页时,我试遍了市面上所有开源方案,最终被Fenrus的颜值和扩展性征服。这个基于.NET 6开发的导航页不仅支持Docker一键部署,更提供了以下杀手级特性:
但真正让我决定写这篇教程的,是它完美解决了移动端访问的痛点。通过内网穿透技术,我现在能在任何地方用手机浏览器访问家里的导航页,收藏的网址、记录的笔记随手可得。下面分享从部署到外网访问的完整方案。
实测发现树莓派4B(4GB内存)即可流畅运行,但推荐x86设备以获得更好的Docker兼容性。我的测试环境是:
新建docker-compose.yml文件如下:
yaml复制version: '3'
services:
fenrus:
image: revenz/fenrus
container_name: fenrus
ports:
- "8080:80"
volumes:
- ./data:/app/data
restart: unless-stopped
启动后访问http://localhost:8080,首次登录使用默认账号:
重要安全提示:务必在登录后立即修改密码!数据目录
./data保存了所有配置和用户数据,建议定期备份。
测试了三种主流方案后,最终选择方案C:
| 方案 | 配置复杂度 | 带宽限制 | 稳定性 | 成本 |
|---|---|---|---|---|
| 方案A | 中等 | 无 | 一般 | 免费 |
| 方案B | 简单 | 1Mbps | 好 | ¥9/月 |
| 方案C(cpolar) | 极简 | 无 | 优秀 | 免费 |
注册后获取authtoken,Linux下安装:
bash复制curl -L https://www.cpolar.com/static/downloads/install-release-cpolar.sh | sudo bash
创建systemd服务(以Ubuntu为例):
bash复制sudo systemctl enable cpolar
sudo systemctl start cpolar
配置文件/etc/cpolar/cpolar.yml示例:
yaml复制authtoken: your_token_here
tunnels:
fenrus:
addr: 8080
proto: http
region: hk
hostname: yourname.cpolar.cn
nginx复制server {
listen 80;
server_name localhost;
location / {
proxy_pass http://fenrus;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
add_header X-Frame-Options "DENY";
}
}
bash复制cpolar http 8080 -hostname=yourdomain.com -https=true
在Fenrus后台设置中:
实测效果:iOS设备通过Safari添加后,使用体验接近原生APP。
bash复制sudo ufw allow 4040/tcp # cpolar监控端口
sudo ufw allow 8080/tcp
bash复制journalctl -u cpolar -f # 查看实时日志
curl http://localhost:4040/api/tunnels # 获取穿透地址
当发现加载缓慢时:
yaml复制services:
fenrus:
mem_limit: 512m
nginx复制location / {
expires 7d;
add_header Cache-Control "public";
}
我的实际应用方案:
对于团队使用:
sql复制-- 示例数据库配置
INSERT INTO UserGroups VALUES (1, '研发部', 'RW');
最终我的导航页日均访问量稳定在50+次,最受欢迎的三大功能是: