Files
nexus/wiki/sources/tong-guo-vps-nei-wang-fan-xiang-dai-li-shi-xian-yu-ming-fang-wen-nei-wang-chuan-tou.md
2026-04-14 16:02:50 +08:00

64 lines
1.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: "通过VPS+内网反向代理实现域名访问内网穿透"
type: source
tags: [vps, caddy, frp, reverse-proxy, cloudflare, 内网穿透]
date: 2026-04-13
source_file: raw/Technical/Home Office/通过VPS+内网反向代理实现域名访问内网穿透.md
---
## Summary
- 核心主题通过FRP+Caddy实现从公网域名访问内网服务
- 问题域:内网服务暴露、域名解析、反向代理配置
- 方法/机制frps(VPS) + frpc(内网) + Caddy反向代理
- 结论/价值:构建完整的内网穿透访问体系
## Key Claims
- FRP支持TCP/HTTP/HTTPS多种映射
- Caddy自动申请Let's Encrypt证书
- DNS托管于Cloudflare
- 阿里云DNS解析到VPS公网IP
## Key Concepts
- [[内网穿透]]FRP反向隧道技术
- [[反向代理]]Caddy处理HTTPS
- [[Caddy]]现代化Web服务器
- [[FRP]]:内网穿透工具
## Key Entities
- [[VPS]]公网中转服务器192.227.222.142
- [[Caddy]]:反向代理/HTTPS服务器
- [[FRP]]:内网穿透工具
- [[Cloudflare]]DNS托管
- [[阿里云DNS]]:域名解析
## Connections
- [[内网服务]] ← frpc ← [[VPS frps]]
- [[VPS]] ← Caddy反代 ← 公网
- [[阿里云DNS]] ← 解析 ← [[Cloudflare]]
## 架构拓扑
```
Internet
VPS (192.227.222.142)
├─ frps (端口7000)
└─ Caddy (80/443)
内网主机 frpc
NAS/Ubuntu
```
## 域名映射表
| 域名 | 目标端口 | 服务 |
|------|----------|------|
| nas.ishenwei.online | 15000 | NAS DSM |
| n8n.ishenwei.online | 15678 | n8n |
| grafana.ishenwei.online | 13000 | Grafana |
## 故障排查步骤
1. 确认frps监听端口`ss -lntup | grep 7000`
2. 检查进程配置:`ps -ef | grep frps`
3. 验证防火墙:`sudo ufw status`
4. 检查Caddy配置`sudo caddy validate`
5. 查看frps日志`journalctl -u frps`