Take a look at gzxhwq/sing-box if you prefer docker. Use our configurations in combination.
sudo su
apt update && apt install -y build-essential
curl -fsL https://raw.githubusercontent.com/jetsung/golang-install/main/install.sh | bash
source /root/.bashrc
go install -v -tags "with_acme with_ech with_quic with_utls with_v2ray_api with_clash_api with_gvisor with_lwip with_grpc with_quic with_wireguard with_ech with_utls with_gvisor with_shadowsocksr" github.com/sagernet/sing-box/cmd/sing-box@dev-next
cp ~/go/bin/sing-box /usr/local/bin/
mkdir /etc/sing-box/ && cd $_
wget -c -P /etc/sing-box "https://github.com/SagerNet/sing-geoip/releases/latest/download/geoip.db"
wget -c -P /etc/sing-box "https://github.com/SagerNet/sing-geosite/releases/latest/download/geosite.db"
cd /etc/sing-box && sing-box run
You can now connect your client. When the connection is unsuccessful, press ctrl + c to stop the server.
Change log>disabled = false at line 3 of config.json. You can find a possible solution by starting the server again and reading the server log.
In production, logs should always be turned off. I suggest the following clients:
Android: Matsuri, Sagernet Windows: Qv2ray iPhone: FairVPN, ShadowLink
After running sing-box and successfully connecting your client, it's time to install it as a service:
cat <<EOF > /etc/systemd/system/sing-box.service
[Unit]
Description=sing-box Service
Documentation=https://sing-box.sagernet.org/
After=network.target nss-lookup.target
Wants=network.target
[Service]
Type=simple
ExecStart=sing-box run -c /etc/sing-box/config.json
Restart=always
RestartSec=3s
RestartPreventExitStatus=23
LimitNPROC=10000
LimitNOFILE=1000000
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload && systemctl enable sing-box && systemctl start sing-box
systemctl status sing-box
If you need to check the logs in service mode you can always run:
journalctl -xefu sing-box