0%

Trojan科学新姿势

本文介绍Trojan科学上网一键脚本配置。

准备工作

VPS

我选择的是Google VPS,创建一个台湾或香港实例,选择debian9或10,记录外网IP。

域名

  1. 购买域名可以选择namesilonamecheap;
  2. 在域名的dns解析设置里新增一个A解析记录,hostname填写任意字符串,如a或0,则后面配置VPS绑定域名时就是a.xxx.com0.xxx.com,IP填写上面的外网IP, TTL填写3603。注意这里的A解析后面用来配IP地址,表示访问某个域名指向某IP。
  3. 等待域名解析生效可以通过ping域名方式,一般需要10分钟。

备注:如果是namesilo可以直接访问https://www.namesilo.com/account_domain_manage_dns.php修改DNS解析,万网访问https://dns.console.aliyun.com/#/dns/domainList

服务端

SSH登陆

首先进行SSH登陆,如果是Google VPS需要进行以下配置:

1
2
sudo -i
vi /etc/ssh/sshd_config

修改配置:

1
2
PermitRootLogin yes
PasswordAuthentication yes

然后记得通过passwd root设置root登陆密码。

然后重启SSH:

1
service sshd restart

如何配置

  1. 安装准备软件:
1
2
3
apt-get update -y && apt-get install curl -y    ##Ubuntu/Debian 系统安装 Curl 方法
apt-get install xz-utils #Debian/Ubuntu 安装 XZ 压缩工具命令
apt-get install vim
  1. 下载一键安装脚本
    通过wget https://github.com/V2RaySSR/Trojan/raw/master/Trojan.sh或直接
1
bash <(curl -s -L https://github.com/V2RaySSR/Trojan/raw/master/Trojan.sh)

之后先安装BBR Plus内核,然后开启BBRPlus加速,中间会选择重启VPS。然后安装Trajon,安装时输入对应域名即可。

3. 安装完毕后查看密码及重启命令

修改密码:

1
/usr/src/trojan/server.conf

重启:

1
systemctl restart trojan

查看状态:

1
service trojan status

定时重启

1
2
3
4
5
6
7
8
9
10
11
apt-get install cron
crontab -e
输入:0 4 * * * /sbin/reboot

启动:/etc/init.d/cron start

关闭:/etc/init.d/cron stop

重启『/etc/init.d/cron restart

查看列表:crontab -l

端侧

Windows、Mac、Linux

Windows上直接下载安装完毕后生成的压缩包,点击启动bat即可。也可以到官网下载。修改config.json即可。
注意:非windows的客户端使用时,最好是从安装完成后的下载链接里,把完整证书fullchain.cer和配置config.json下载下来,然后copy到对应端的脚手架工程里。

Mac

TrojanX

Android

igniter

常见错误

问题1:ssl handshake timeout

优先通过https://tool.chinaz.com/port检查443端口是否被封,如果被封则修改Trojan的端口为其他端口,server端编辑/usr/src/trojan/server.conf里的端口即可,然后客户端使用相同的端口即可。

如果遇到证书没有申请成功:一键安装的时候显示 https证书没有申请成果,本次安装失败观察是否存在以下错误:

1
It is recommended to install socat first

如果存在的话执行下面命令解决:

1
apt-get update && apt-get install curl -y && apt-get install cron -y && apt-get install socat -y

问题3:Please update your account with an email address first

解决替换自己的邮箱:

1
2
3
.acme.sh/acme.sh  --uninstall

curl https://get.acme.sh | sh -s email=xxxx@xx.com

问题4:一直报Order status is processing, lets sleep and retry

如果在签发 ZeroSSL 证书时,不停的循环 Order status is processing, lets sleep and retry。可以选择将 CA 更换为 Let’s Encrypt。

1
acme.sh --set-default-ca --server letsencrypt

问题5:nginx启动错误:

1
nginx: [emerg] open() "/etc/nginx/mime.types" failed (2: No such file or directory) in /etc/nginx/nginx.conf:9

解决vim mime.types内容如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
types {
text/html html htm shtml;
text/css css;
text/xml xml;
image/gif gif;
image/jpeg jpeg jpg;
application/javascript js;
application/atom+xml atom;
application/rss+xml rss;

text/mathml mml;
text/plain txt;
text/vnd.sun.j2me.app-descriptor jad;
text/vnd.wap.wml wml;
text/x-component htc;

image/png png;
image/tiff tif tiff;
image/vnd.wap.wbmp wbmp;
image/x-icon ico;
image/x-jng jng;
image/x-ms-bmp bmp;
image/svg+xml svg svgz;
image/webp webp;

application/font-woff woff;
application/java-archive jar war ear;
application/json json;
application/mac-binhex40 hqx;
application/msword doc;
application/pdf pdf;
application/postscript ps eps ai;
application/rtf rtf;
application/vnd.apple.mpegurl m3u8;
application/vnd.ms-excel xls;
application/vnd.ms-fontobject eot;
application/vnd.ms-powerpoint ppt;
application/vnd.wap.wmlc wmlc;
application/vnd.google-earth.kml+xml kml;
application/vnd.google-earth.kmz kmz;
application/x-7z-compressed 7z;
application/x-cocoa cco;
application/x-java-archive-diff jardiff;
application/x-java-jnlp-file jnlp;
application/x-makeself run;
application/x-perl pl pm;
application/x-pilot prc pdb;
application/x-rar-compressed rar;
application/x-redhat-package-manager rpm;
application/x-sea sea;
application/x-shockwave-flash swf;
application/x-stuffit sit;
application/x-tcl tcl tk;
application/x-x509-ca-cert der pem crt;
application/x-xpinstall xpi;
application/xhtml+xml xhtml;
application/xspf+xml xspf;
application/zip zip;

application/octet-stream bin exe dll;
application/octet-stream deb;
application/octet-stream dmg;
application/octet-stream iso img;
application/octet-stream msi msp msm;

application/vnd.openxmlformats-officedocument.wordprocessingml.document docx;
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx;
application/vnd.openxmlformats-officedocument.presentationml.presentation pptx;

audio/midi mid midi kar;
audio/mpeg mp3;
audio/ogg ogg;
audio/x-m4a m4a;
audio/x-realaudio ra;

video/3gpp 3gpp 3gp;
video/mp2t ts;
video/mp4 mp4;
video/mpeg mpeg mpg;
video/quicktime mov;
video/webm webm;
video/x-flv flv;
video/x-m4v m4v;
video/x-mng mng;
video/x-ms-asf asx asf;
video/x-ms-wmv wmv;
video/x-msvideo avi;
}

补充

  1. Trojan目前的客户端只是socks5代理,Chrome浏览器需要配合SwitchyOmega使用;
  2. 相对于SS使用加密模式,Trojan最大的不同是 伪装 成普通的HTTPS流量实现过墙。
  3. 检查是否被封的方法

参考