Self-Hosted Web Server 的端口转发

需要开放的端口

80TCPHTTP — required for Let's Encrypt HTTP-01 challenges and for plain HTTP fallback.
443TCPHTTPS — primary user-facing port.

为什么需要端口转发?

Running a personal blog, status page, or photo gallery from home means inbound 80/443 must reach the LAN host. With a dynamic DNS service (DuckDNS, Cloudflare DNS) you can keep a stable hostname despite ISP IP changes.

按路由器品牌逐步操作

TP-Link
  1. Get a static internal IP for the server
  2. NAT Forwarding → Virtual Servers → forward 80 and 443 to that IP
  3. If your ISP blocks 80 (some do — check by trying outside), use port 8080 → 80 instead
  4. Set up DDNS in the router for a stable public hostname
Netgear
  1. Advanced → Dynamic DNS → register a free hostname (No-IP, DynDNS)
  2. Port Forwarding → forward 80 + 443 to the server's LAN IP
  3. On the server, point Nginx / Caddy / Apache at those ports
ASUS
  1. WAN → Virtual Server → Add 80 and 443 forwards
  2. WAN → DDNS → enable ASUS's free *.asuscomm.com hostname
  3. On the server, configure Caddy / Nginx with that hostname for automatic Let's Encrypt

安全警告

Use Caddy or Nginx with auto-TLS, keep ssh on a non-default port if also exposing it, and rate-limit. Cloudflare Tunnel is a strong alternative that requires NO port forwarding.

相关指南

安全提示

正在使用默认密码?使用 NordVPN 加密保护您的网络。