← 返回導覽

特洛伊協議

Trojan Protocol Deployment

原生部署 (Native)

不依賴容器,直接在系統層面運行的 Trojan 服務端。適合追求極致輕量與效能的場景。

1. 安裝與依賴

apt update && apt install -y curl wget socat nginx
# 獲取 Trojan 二進制檔 (示例)
wget https://github.com/trojan-gfw/trojan/releases/download/v1.16.0/trojan-1.16.0-linux-amd64.tar.xz
tar -xf trojan-1.16.0-linux-amd64.tar.xz
cp trojan/trojan /usr/local/bin/

2. 伺服器配置 (config.json)

{
    "run_type": "server",
    "local_addr": "0.0.0.0",
    "local_port": 443,
    "remote_addr": "127.0.0.1",
    "remote_port": 80,
    "password": ["your_password"],
    "ssl": {
        "cert": "/etc/ssl/trojan/cert.crt",
        "key": "/etc/ssl/trojan/private.key"
    }
}

客戶端配置

適用於 Windows / macOS / Mobile 的通用配置結構。

{
    "run_type": "client",
    "local_addr": "127.0.0.1",
    "local_port": 1080,
    "remote_addr": "your-domain.com",
    "remote_port": 443,
    "password": ["your_password"],
    "ssl": {
        "verify": true,
        "sni": "your-domain.com"
    }
}