內網(wǎng)穿透是指在內網(wǎng)環(huán)境中,將內網(wǎng)服務暴露在公網(wǎng),允許外部用戶訪問這些服務的一種技術。常見的使用場景包括遠程桌面、Web 服務、物聯(lián)網(wǎng)設備等。
本文將介紹如何使用 frp (Fast Reverse Proxy)進行內網(wǎng)穿透,并給出詳細的操作步驟及命令示例。
frp 是一個高性能的反向代理應用,支持 TCP 和 HTTP 等多種協(xié)議,可以輕松實現(xiàn)內網(wǎng)穿透。它主要由兩部分組成:frps(服務端)和 frpc(客戶端)。
wget https://github.com/fatedier/frp/releases/latest/download/frp_x.xx_linux_amd64.tar.gz
tar -zxvf frp_x.xx_linux_amd64.tar.gz
cd frp_x.xx_linux_amd64
[common]
bind_port = 7000
./frps -c ./frps.ini
wget https://github.com/fatedier/frp/releases/latest/download/frp_x.xx_linux_amd64.tar.gz
tar -zxvf frp_x.xx_linux_amd64.tar.gz
cd frp_x.xx_linux_amd64
[common]
server_addr = x.x.x.x # 替換為你的服務器公網(wǎng)IP
server_port = 7000
[web]
type = http
local_port = 80 # 內網(wǎng)服務端口
custom_domains = yourdomain.com # 自定義域名
./frpc -c ./frpc.ini
[common]
# 在 frps.ini 中添加
tls_enable = true
# 在 frpc.ini 中添加
tls_enable = true
[common]
log_file = ./frps.log
log_level = info
]]>