1.首先安装宝塔
2.添加网站并在宝塔里申请免费的ssl证书,然后直接部署,例如www.trojan.com
3.安装Trojan
1 |
<span class="pln">bash </span><span class="pun"><(</span><span class="pln">curl </span><span class="pun">-</span><span class="pln">fsSL https</span><span class="pun">:</span><span class="com">//raw.githubusercontent.com/trojan-gfw/trojan-quickstart/master/trojan-quickstart.sh)</span> |
1 |
<span class="pln">nano </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">trojan</span><span class="pun">/</span><span class="pln">config</span><span class="pun">.</span><span class="pln">json</span> |
把”local_port”改为442
把”cert”改为 /www/server/panel/vhost/ssl/你的域名/fullchain.pem
把”key”改为 /www/server/panel/vhost/ssl/你的域名/privkey.pem
把password1和2改成你自己的密码
然后保存,至此配置完成,然后启动。
Trojan的启动/停止/重启/查看状态/开机自启命令
1 2 3 4 5 6 7 8 9 |
<span class="pln">systemctl start trojan systemctl stop trojan systemctl restart trojan systemctl status trojan systemctl enable trojan</span> |
4.开启宝塔的反向代理
然后保存即可。
补充说明:代理目录里可以存放伪装网站,网站可以正常HTTPS打开,宝塔还可以搭建其他网站不影响这个。宝塔需放行442端口,客户端设置Trojan时端口填442,根据另一篇文章https://www.foxzc.com/archives/2020/06/17/132,Trojan+v2Ray+宝塔三者是可以共存的。再加个N个网站添加ssl都是没问题的