前置条件 👉安装 Go 环境
Install
# install git
sudo apt-get install git
# install gost
go get -u github.com/ginuerzh/gost/cmd/gost
# add env path
# ...
Start
#!/bin/bash
DOMAIN="yourdomain.com"
USER="usr"
PASS="password"
PORT=443
BIND_IP=0.0.0.0
CERT="/root/.acme.sh/${DOMAIN}/${DOMAIN}.cer"
KEY="/root/.acme.sh/${DOMAIN}/${DOMAIN}.key"
nohup gost -L "http2://${USER}:${PASS}@${BIND_IP}:${PORT}?cert=${CERT}&key=${KEY}" > /dev/null 2>&1 &
read -p 'The service is already running in the background, press any key to continue.'
加执行权限
chmod 755 ./*.sh
Stop
#!/bin/bash
ps -ef|grep gost|grep -v grep|awk '{print $2}'|xargs kill -9
注意
- 重新续期证书后,需要运行 stop 脚本后再启动