Trojan 完整安装和部署教程

你的信息

域名:你的域名

IP:xxx.xxx.xxx.xxx

密码:你的密码

端口:443

一、重装系统后第一步:放行端口(必须最先做)

bash

运行

ufw allow 80/tcp

ufw allow 443/tcp

ufw reload

二、申请 SSL 证书(必须放行端口后再做)

bash

运行

apt update && apt install certbot -y

bash

运行

certbot certonly –standalone -d 你的域名 –email test@example.com –agree-tos –no-eff-email

出现成功提示即可继续。

三、安装 Nginx(伪装网站用)

bash

运行

apt install nginx -y

systemctl stop nginx

四、安装 Trojan

bash

运行

bash <(curl -sL https://raw.githubusercontent.com/trojan-gfw/trojan-quickstart/master/trojan-quickstart.sh)

五、写入最终配置

bash

运行

cat > /usr/local/etc/trojan/config.json << ‘EOF’

{

  “run_type”: “server”,

  “local_addr”: “0.0.0.0”,

  “local_port”: 443,

  “remote_addr”: “127.0.0.1”,

  “remote_port”: 80,

  “password”: [

    “你的密码”

  ],

  “ssl”: {

    “cert”: “/etc/letsencrypt/live/你的域名/fullchain.pem”,

    “key”: “/etc/letsencrypt/live/你的域名/privkey.pem”,

    “alpn”: [

      “h2”,

      “http/1.1”

    ],

    “reuse_session”: true,

    “session_ticket”: false

  },

  “tcp”: {

    “no_delay”: true,

    “keep_alive”: true

  }

}

EOF

六、启动 Trojan

bash

运行

systemctl enable trojan

systemctl restart trojan

七、客户端连接配置

连接信息

类型:Trojan

服务器:你的域名

端口:443

密码:你的密码

TLS:开启

跳过证书校验:关闭

支持的客户端

Windows:Trojan-Qt5

Android:Igniter

iOS:Shadowrocket、Trojan

八、验证是否运行成功

bash

运行

systemctl status trojan

出现 active (running) 就是成功。

类似文章