2020年8月23日星期日

V2Ray Trojan Go 共存 共用443

nano /etc/caddy/Caddyfile

你的域名:80 {
    gzip
timeouts none
    proxy / https://www.techspot.com/ {
        except /game
    }
    proxy /game 127.0.0.1:37292 {
        without /game
        websocket
    }
}
import sites/*


其中红字对应V2Ray参数


===================================

nano /root/trojan-go/config.json
{
    "run_type": "server",
    "local_addr": "0.0.0.0",
    "local_port": 443,
    "remote_addr": "127.0.0.1",
    "remote_port": 80,
    "password": [
        "9564564645u87"
    ],
    "ssl": {
        "cert": "/etc/ssl/caddy/acme/acme-v02.api.letsencrypt.org/sites/你域名/你域名.crt",
        "key": "/etc/ssl/caddy/acme/acme-v02.api.letsencrypt.org/sites/你域名/你域名.key"
    }
}

============Trojan-go自启动==========================
架设Trojan-go 与便以文件在root/Trojan-go文件夹内

cp /root/trojan-go/example/trojan-go.service /etc/systemd/system
nano /etc/systemd/system/trojan-go.service

改成如下

[Unit]
Description=Trojan-Go - An unidentifiable mechanism that helps you bypass GFW
Documentation=https://p4gefau1t.github.io/trojan-go/
After=network.target network-online.target nss-lookup.target mysql.service mariadb.service mysqld.service
Wants=network-online.target

[Service]
Type=simple
User=root
ExecStart=/root/trojan-go/trojan-go -config /root/trojan-go/config.json
Restart=on-failure
RestartSec=10s
RestartPreventExitStatus=23

[Install]
WantedBy=multi-user.target

首先  systemctl daemon-reload ,然后 systemctl enable trojan-go 设置为开机自启,在然后 systemctl start trojan-go 启动 Trojan-Go。systemctl status trojan-go 可以查看 Trojan-Go 状态


没有评论:

发表评论

caddy反代下载文件

# 监听端口 51110,提供静态文件服务和目录浏览 :51110 {     root * /home/tls     encode gzip  # 只启用 gzip 压缩     file_server {         browse     }     # 使用提供的证书...