无论trojan-go,trojan都不行,代码如下:
uname -m
x86_64
command -v apt
command -v dnf
command -v yum
/usr/bin/yum
command -v zypper
command -v systemctl
/usr/bin/systemctl
command -v getenforce
/usr/sbin/getenforce
检测结果:OK!
getenforce
Disabled
正在检测域名是否解析到当前VPS的IP上......
curl -4 ip.sb
ip
ping 域名 -c 1 | grep -oE -m1 "([0-9]{1,3}.){3}[0-9]{1,3}"
ip
解析正确!OK!
检测端口占用情况......
lsof -n -P -i :80 | grep LISTEN
lsof -n -P -i :443 | grep LISTEN
检测结果:未被占用!
系统环境检测完毕,符合安装要求,开始布署......
开启防火墙相应端口......
firewall-cmd --zone=public --add-port=80/tcp --permanent
�[91mFirewallD is not running�[00m
firewall-cmd --zone=public --add-port=443/tcp --permanent
�[91mFirewallD is not running�[00m
yes | firewall-cmd --reload
�[91mFirewallD is not running�[00m
yum -q makecache
yum -y -q install xz-utils
正在安装Trojan......
curl -o /tmp/trojan-quickstart.sh https://raw.githubusercontent.com/trojan-gfw/trojan-quickstart/master/trojan-quickstart.sh
yes | bash /tmp/trojan-quickstart.sh
Entering temp directory /tmp/tmp.YnZUF17AyC...
Downloading trojan 1.16.0...
Unpacking trojan 1.16.0...
Installing trojan 1.16.0 to /usr/local/bin/trojan...
Installing trojan server config to /usr/local/etc/trojan/config.json...
Installing trojan systemd service to /etc/systemd/system/trojan.service...
Reloading systemd daemon...
Deleting temp directory /tmp/tmp.YnZUF17AyC...
Done!
find / -name trojan
/usr/local/bin/trojan
/usr/local/etc/trojan
Trojan安装成功!
systemctl enable trojan
mv /usr/local/etc/trojan/config.json /usr/local/etc/trojan/config.json.1
安装完毕,上传配置文件......
正在安装acme.sh......
yum -q makecache
yum -y -q install socat
Package socat-1.7.3.2-2.el7.x86_64 already installed and latest version
curl https://raw.githubusercontent.com/acmesh-official/acme.sh/master/acme.sh | INSTALLONLINE=1 sh
[Fri Sep 4 15:15:54 PDT 2020] Installing from online archive.
[Fri Sep 4 15:15:54 PDT 2020] Downloading https://github.com/acmesh-official/acme.sh/archive/master.tar.gz
[Fri Sep 4 15:15:57 PDT 2020] Extracting master.tar.gz
[Fri Sep 4 15:15:57 PDT 2020] Installing to /root/.acme.sh
[Fri Sep 4 15:15:57 PDT 2020] Installed to /root/.acme.sh/acme.sh
[Fri Sep 4 15:15:57 PDT 2020] Installing alias to '/root/.bashrc'
[Fri Sep 4 15:15:57 PDT 2020] OK, Close and reopen your terminal to start using acme.sh
[Fri Sep 4 15:15:57 PDT 2020] Installing alias to '/root/.cshrc'
[Fri Sep 4 15:15:57 PDT 2020] Installing alias to '/root/.tcshrc'
[Fri Sep 4 15:15:57 PDT 2020] Installing cron job
56 0 * * * "/root/.acme.sh"/acme.sh --cron --home "/root/.acme.sh" > /dev/null
[Fri Sep 4 15:15:57 PDT 2020] Good, bash is found, so change the shebang to use bash as preferred.
[Fri Sep 4 15:15:58 PDT 2020] OK
[Fri Sep 4 15:15:58 PDT 2020] Install success!
acme.sh安装成功!
cd ~/.acme.sh/
alias acme.sh=~/.acme.sh/acme.sh
申请域名证书......
/root/.acme.sh/acme.sh --issue --standalone -d 域名
[Fri Sep 4 15:16:04 PDT 2020] Using CA: https://acme-v02.api.letsencrypt.org/directory
[Fri Sep 4 15:16:04 PDT 2020] Standalone mode.
[Fri Sep 4 15:16:04 PDT 2020] Creating domain key
[Fri Sep 4 15:16:04 PDT 2020] The domain key is here: /root/.acme.sh/域名/域名.key
[Fri Sep 4 15:16:04 PDT 2020] Single domain='域名'
[Fri Sep 4 15:16:04 PDT 2020] Getting domain auth token for each domain
[Fri Sep 4 15:16:06 PDT 2020] Getting webroot for domain='域名'
[Fri Sep 4 15:16:06 PDT 2020] Verifying: 域名
[Fri Sep 4 15:16:06 PDT 2020] Standalone mode server
[Fri Sep 4 15:16:10 PDT 2020] Pending
[Fri Sep 4 15:16:12 PDT 2020] Pending
[Fri Sep 4 15:16:15 PDT 2020] Pending
[Fri Sep 4 15:16:17 PDT 2020] Pending
[Fri Sep 4 15:16:20 PDT 2020] Pending
[Fri Sep 4 15:16:22 PDT 2020] Pending
[Fri Sep 4 15:16:24 PDT 2020] Pending
[Fri Sep 4 15:16:26 PDT 2020] Pending
[Fri Sep 4 15:16:29 PDT 2020] Pending
[Fri Sep 4 15:16:31 PDT 2020] Pending
[Fri Sep 4 15:16:34 PDT 2020] Pending
[Fri Sep 4 15:16:36 PDT 2020] Pending
[Fri Sep 4 15:16:39 PDT 2020] Success
[Fri Sep 4 15:16:39 PDT 2020] Verify finished, start to sign.
[Fri Sep 4 15:16:39 PDT 2020] Lets finalize the order.
[Fri Sep 4 15:16:39 PDT 2020] Le_OrderFinalize='https://acme-v02.api.letsencrypt.org/acme/finalize/95759182/5013942854'
[Fri Sep 4 15:16:40 PDT 2020] Downloading cert.
[Fri Sep 4 15:16:40 PDT 2020] Le_LinkCert='https://acme-v02.api.letsencrypt.org/acme/cert/0461cf8059c0119b04f042ef74d92c3797c1'
[Fri Sep 4 15:16:40 PDT 2020] Cert success.
-----BEGIN CERTIFICATE-----
MIIFYDCCBEigAwIBAgISBGHPgFnAEZsE8ELvdNksN5fBMA0GCSqGSIb3DQEBCwUA
MEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQD
ExpMZXQncyBFbmNyeXB0IEF1dGhvcml0eSBYMzAeFw0yMDA5MDQwNjE4MzJaFw0y
MDEyMDMwNjE4MzJaMB8xHTAbBgNVBAMTFHRyMTAxLmZyZWVkb20xMDMueHl6MIIB
IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4A98mNjjQopSv9avNLU+Fzo1
NWkXvjnmrccqG7m2l/asxuVPM6/2GWOEvLsVaOhp1zQlk25Ksgt5BX5ju6hp49C1
/QCIeTsEPc6C8r/GPYfMCGHD40R43V/iNIppJTHLZ8eigNOS3Ph0d95YhCpeSyOK
tFRBGx/XdOaRiiNacJUQCNke7vqkAPTMLALjuWJTtYZ2LdZ3acLd01G5T4Xa/+ev
TVcD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kb/g0+XcbpYsnEw3RNeoGfjRHxYUIa
9Sukl5ZDDC3Zmwag639pyFP7MESt4gDRdoj5IVhpx7swMhyfJWyB6vffCMDCVUNi
A/u+v2KAGtxQ3tNH0afKBhJKgl6O5mDtIGzLcKA3klkKyKd6RFg8WO7Ag9dws8JJ
9PrnDW3nP9zyHyTA/LibYpUIkch6f6BVI/cAmp0xEpwaqtq753d3ib8v/JJo4J8H
8ICxM5Ypigz3xZqGtC3OBtO5bIoYwa7HmPG/MUozWc6+o6Lk
-----END CERTIFICATE-----
[Fri Sep 4 15:16:40 PDT 2020] Your cert is in /root/.acme.sh/域名/域名.cer
[Fri Sep 4 15:16:40 PDT 2020] Your cert key is in /root/.acme.sh/域名/域名.key
[Fri Sep 4 15:16:40 PDT 2020] The intermediate CA cert is in /root/.acme.sh/域名/ca.cer
[Fri Sep 4 15:16:40 PDT 2020] And the full chain certs is there: /root/.acme.sh/域名/fullchain.cer
证书申请成功!
安装证书到Trojan......
/root/.acme.sh/acme.sh --installcert -d 域名 --certpath /usr/local/etc/trojan/trojan_ssl.crt --keypath /usr/local/etc/trojan/trojan_ssl.key --capath /usr/local/etc/trojan/trojan_ssl.crt --reloadcmd "systemctl restart trojan"
[Fri Sep 4 15:16:44 PDT 2020] Installing cert to:/usr/local/etc/trojan/trojan_ssl.crt
[Fri Sep 4 15:16:44 PDT 2020] Installing CA to:/usr/local/etc/trojan/trojan_ssl.crt
[Fri Sep 4 15:16:44 PDT 2020] Installing key to:/usr/local/etc/trojan/trojan_ssl.key
[Fri Sep 4 15:16:44 PDT 2020] Run reload cmd: systemctl restart trojan
if [ ! -f "/usr/local/etc/trojan/trojan_ssl.key" ]; then echo "0"; else echo "1"; fi | head -n 1
1
证书成功安装到Trojan!
chmod 644 /usr/local/etc/trojan/trojan_ssl.key
安装Caddy......
yum install yum-plugin-copr -y
Loaded plugins: copr, fastestmirror
Loading mirror speeds from cached hostfile
- base: mirrors.umflint.edu
- extras: repos-lax.psychz.net
- updates: centos3.zswap.net
Package yum-plugin-copr-1.1.31-54.el7_8.noarch already installed and latest version
Nothing to do
yum copr enable @caddy/caddy -y
Loaded plugins: copr, fastestmirror
copr done
yum -y -q install caddy
Package caddy-2.2.0~rc1-1.el7.x86_64 already installed and latest version
find / -name caddy
/etc/caddy
/var/lib/caddy
/usr/bin/caddy
/usr/share/bash-completion/completions/caddy
/usr/share/caddy
Caddy安装成功!
systemctl enable caddy
上传Caddy配置文件......
mv /etc/caddy/Caddyfile /etc/caddy/Caddyfile.bak
sed -i 's/##domain##/域名/' /etc/caddy/Caddyfile
Caddy配置文件上传成功,OK!
正在启动Caddy......
systemctl restart caddy
ps aux | grep caddy
root 11059 0.0 0.0 113288 3164 ? Ss 15:17 0:00 bash -c ps aux | grep caddy
root 11065 0.0 0.0 112812 2288 ? S 15:17 0:00 grep caddy
Caddy启动失败!
正在启动Caddy(第二次尝试)!
systemctl restart caddy
ps aux | grep caddy
root 11090 0.0 0.0 113288 3104 ? Ss 15:17 0:00 bash -c ps aux | grep caddy
root 11096 0.0 0.0 112812 2296 ? S 15:17 0:00 grep caddy
Caddy启动失败(第二次)!退出安装!