TrojanInV2ray
{"log": {"loglevel": "info"},"inbounds": [{"port": 443,"protocol": "trojan","settings": {"fallbacks": [{"dest": 80}],"clients": [{"password": "!@#$%^&*()"}]},"streamSettings": {"network": "tcp","security": "xtls","xtlsSettings": {"alpn": ["http/1.1"],"certificates": [{"certificateFile": "/etc/letsencrypt/live/z.huhu.blue/privkey.pem","keyFile": "/etc/letsencrypt/live/z.huhu.blue/fullchain.pem"}]}}}],"outbounds": [{"protocol": "freedom"}]}
Certbot
fuser -k 80/tcp;certbot certonly --standalone --register-unsafely-without-email --agree-tos -d none.blue
已经被更新 怎样通过 v2ray 来搭建 trojan 节点, 因为 v2ray 有一天他突然就支持了 trojan, 感觉挺新奇的, 所以就有了这篇文章, 非一键脚本安装, 不会和网上其他的教程雷同。
需要准备一台有 root 权限的 VPS
操作系统 Ubuntu 20.04 TLS +
一个域名已经解析好了 IP 地址
VPS 必须有公网 ipv4 环境, 不适用于 IPv6 only …
vs code 和一个格式转换插件
使用 MobaXterm 这个软件 远程连接到自己的 VPS.
开始编译 V2RAY, 需要准备一些东西, 直接复制粘贴以下命令。
稍等片刻 即可编译完成, 本次编译只生成 v2ray 和 v2ctl 二进制包, 执行下面的命令将它移动到系统环境变量被赋予可执行权限。
下面开始申请证书, 推荐大家通过 snap 安装 certbot 来申请证书。 请将自己的某个域名 指向自己这台 VPS 的 IP, 一般是 A 记录。
然后通过下面的命令生成证书, 域名需要换成自己的,证书存放的路径 是我们需要关心的, 一个是 fullchain.pem 另外一个是 key.pem,如下,
下面开始自定义 v2ray 的配置文件, 此处, 希望大家在电脑上安装好 VS code, 将会使用 VS code 进行配置文件编辑, 然后还需要下载一个 VS code 插件, 这个插件可以帮我们将配置文件进行转换以及 校验配软件是否符合相应的格式.
配置文件具体如下, 需要修改的地方有 三处, 第 1 将 password 改为自己想用的密码, 第 2 将证书 具体的域名换成自己的, 第 3, 将是私钥当中的域名也换成自己的。
[log]loglevel = "info"[[inbounds]]port = 443protocol = "trojan"[inbounds.settings]# apt install nginx[[inbounds.settings.fallbacks]]dest = 80[[inbounds.settings.clients]]password = "!@#$%^&*()"[inbounds.streamSettings]network = "tcp"security = "xtls"[inbounds.streamSettings.xtlsSettings]alpn = ["http/1.1"]# snap install certbot# `/etc/letsencrypt/live/<your-domain>/fullchain.pem`# `/etc/letsencrypt/live/<your-domain>/privkey.pem`[[inbounds.streamSettings.xtlsSettings.certificates]]certificateFile = "/etc/letsencrypt/live/z.huhu.blue/fullchain.pem"keyFile = "/etc/letsencrypt/live/z.huhu.blue/privkey.pem"[[outbounds]]protocol = "freedom"查看注释最后将当前的汤姆 toml 文件转换成为 json 文件, 使用快捷按键 CTRL+shift+p, 在小窗口搜索关键字 JSON 选中第一个插件。
然后在新出来的小窗口中输入 toml | json 回车, 这样就会教我们当前的配置文件 toml 转为 json。 如果这个插件没有反应, 可以先将配置文件转换成为 yaml, 然后再切换为 Json, toml | yaml ==> toml | json 右边的 编辑区 就是说需要的 json 文件, 复制待用。
{"log": {"loglevel": "info"},"inbounds": [{"port": 443,"protocol": "trojan","settings": {"fallbacks": [{"dest": 80}],"clients": [{"password": "!@#$%^&*()"}]},"streamSettings": {"network": "tcp","security": "xtls","xtlsSettings": {"alpn": ["http/1.1"],"certificates": [{"certificateFile": "/etc/letsencrypt/live/z.huhu.blue/fullchain.pem","keyFile": "/etc/letsencrypt/live/z.huhu.blue/privkey.pem"}]}}}],"outbounds": [{"protocol": "freedom"}]}在终端当中任意位置新建一个文件,nano server.json 然后将刚刚复制的 json 文件粘贴即可。
最后运行 v2ray, 命令如下, 刚刚创建的是 server.json 就是配置文件, 然后就可以通过客户端尝试连接该节点了。
客户端连接 trojan 节点测速正常后, 使用快捷键 ctrl+c 终止命令, 然后用 joker 把命令放在后台运行, 格式如下. 下载 joker, 然后在 v2ray 的命令前面加上 joker 即可。
这样就可以关闭当前终端了, 只要自己的 VPS 不重启,v2ray 就会一直在后台运行。
伪装网站, 可以不用设置。 若想创建一个伪装站点, 执行下面的命令即可。
视频教程
