VPS常用命令
新装VPS必用命令
root用户密码登录
root用户密钥登录
VPS重装系统脚本
Oracle DD系统后获取ipv6地址
V2ray安装
x-ui安装
PVE实用命令
speedtest-cli
OpenWrt接口配置示例
利用Cloudflare Tunnel实现内网穿透
ubuntu通过netplan设置静态ip
PVE温度显示以及去除弹窗脚本
Caddy示例配置文件
hysteria2的搭建与使用
Clash Meta配置模板
VPS流量监控脚本
rclone完全备份脚本
Oracle Cloud安装Alpine Linux
Caddy-dns的配置与使用
sing-box安装与配置
通过 CF Warp 为 IPv4/6 Only VPS 添加 IPv6/4 支持
流量转发脚本
ssh配置文件
rsync传输文件
阿里云盘CLi安装
Linux 设置IPv4优先
流量监控脚本
Openwrt中使用ddns-go加Caddy实现域名访问
NAT VPS 使用 Caddy 为内部服务提供 HTTPS 访问
Docker 多平台镜像构建与推送教程(arm64 主机示例)
本文档使用 MrDoc 发布
-
+
首页
sing-box安装与配置
### 仓库安装 ```bash sudo curl -fsSL https://sing-box.app/gpg.key -o /etc/apt/keyrings/sagernet.asc sudo chmod a+r /etc/apt/keyrings/sagernet.asc echo "deb [arch=`dpkg --print-architecture` signed-by=/etc/apt/keyrings/sagernet.asc] https://deb.sagernet.org/ * *" | \ sudo tee /etc/apt/sources.list.d/sagernet.list > /dev/null sudo apt-get update dpkg --configure -a sudo apt-get install sing-box systemctl start sing-box systemctl enable sing-box ``` ### 服务管理 | 列名 | 列名 | | --- | --- | | 行动 | 命令 | | 启用 | systemctl enable sing-box | | 禁用 | systemctl disable sing-box | | 启动 | systemctl start sing-box | | 停止 | systemctl stop sing-box | | 重新启动 | systemctl restart sing-box | | 运行状态 | systemctl status sing-box | | 强行停止 | systemctl kill sing-box | | 查看日志 | journalctl -u sing-box --output cat -e | | 实时日志 | journalctl -u sing-box --output cat -f | ### 配置文件示例 `vim /etc/sing-box/config.json` ```bash { "log": { "level": "info" }, "dns": { "servers": [ { "address": "tls://1.1.1.1" } ] }, "inbounds": [ { "type": "shadowsocks", "listen": "::", "listen_port": 8080, "sniff": true, "network": "tcp", "method": "chacha20-ietf-poly1305", "password": "passwd" } ], "outbounds": [ { "type": "direct" }, { "type": "dns", "tag": "dns-out" } ], "route": { "rules": [ { "protocol": "dns", "outbound": "dns-out" } ] } } ``` ### reality配置文件示例 ```bash { "dns": { "servers": [ { "tag": "local", "address": "https://1.1.1.1/dns-query", "detour": "direct" }, { "tag": "block", "address": "rcode://success" } ], "rules": [ { "geosite": "cn", "server": "local" }, { "geosite": "category-ads-all", "server": "block", "disable_cache": true } ] }, "inbounds": [ { "type": "vless", "tag": "vless-in", "listen": "::", "listen_port": 10010, //监听端口 "users": [ { "uuid": "bf000d23-0752-40b4-affe-68f7707a9661", //执行 sing-box generate uuid 生成 "flow": "xtls-rprx-vision" } ], "tls": { "enabled": true, "server_name": "www.microsoft.com", //客户端可用的 serverName 列表,暂不支持 * 通配符 "reality": { "enabled": true, "handshake": { "server": "www.microsoft.com", //目标网站,标准:国外网站,支持 TLSv1.3 与 H2 "server_port": 443 }, "private_key": "UuMBgl7MXTPx9inmQp2UC7Jcnwc6XYbwDNebonM-FCc", // 执行 sing-box generate reality-keypair 生成 "short_id": [ //客户端可用的 shortId 列表,可用于区分不同的客户端 "0123456789abcdef" //执行 openssl rand -hex 8 生成或留空 ] } } } ], "outbounds": [ { "type": "direct", "tag": "direct" }, { "type": "block", "tag": "block" } ], "route": { "rules": [ { "geosite": "cn", "geoip": "cn", "outbound": "direct" }, { "geosite": "category-ads-all", "outbound": "block" } ] } } ``` ### ss+reality ```json { "log": { "level": "info" }, "dns": { "servers": [ { "address": "tls://1.1.1.1" } ] }, "inbounds": [ { "type": "shadowsocks", "listen": "::", "listen_port": 8088, "sniff": true, "network": "tcp", "method": "chacha20-ietf-poly1305", "password": "passwd" }, { "type": "vless", "tag": "vless-in", "listen": "::", "listen_port": 10010, "users": [ { "uuid": "92658abf-3979-4b74-87d6-e27231dc6a0f", "flow": "xtls-rprx-vision" } ], "tls": { "enabled": true, "server_name": "www.microsoft.com", "reality": { "enabled": true, "handshake": { "server": "www.microsoft.com", "server_port": 443 }, "private_key": "sdadadadadadadadadadad", "short_id": [ "sdadadadadadadadadadad" ] } } } ], "outbounds": [ { "type": "direct" }, { "type": "dns", "tag": "dns-out" } ], "route": { "rules": [ { "protocol": "dns", "outbound": "dns-out" } ] } } ``` ### 新版本reality配置文件 ```bash "log": { "level": "info" }, "dns": { "servers": [ { "address": "8.8.8.8" }, { "address": "1.1.1.1" } ] }, "inbounds": [ { "type": "vless", "tag": "vless-in", "listen": "::", "listen_port": 10020, "users": [ { "uuid": "31efb960-c0a9-489f-a72d-e9e4d9155290", "flow": "xtls-rprx-vision" } ], "tls": { "enabled": true, "server_name": "caddy2.kylinos.de", "reality": { "enabled": true, "handshake": { "server": "caddy2.kylinos.de", "server_port": 443 }, "private_key": "YOtLcJFNqHEoZyZ4DOrzqRm7I5LNkoeY64BSgOSjD2w", "short_id": [ "5ece56fc824942ff" ] } } }, { "type": "vless", "tag": "vless-in-2", "listen": "::", "listen_port": 10010, "users": [ { "uuid": "92df0abf-3779-4b74-87d6-e27bb7dc6a0f", "flow": "xtls-rprx-vision" } ], "tls": { "enabled": true, "server_name": "www.microsoft.com", "reality": { "enabled": true, "handshake": { "server": "www.microsoft.com", "server_port": 443 }, "private_key": "YOtLcJFNqHEoZyZ4DOrzqRm7I5LNkoeY64BSgOSjD2w", "short_id": [ "5ece56fc824942ff" ] } } } ], "outbounds": [ { "type": "direct", "tag": "DirectOut" }, { "type": "block", "tag": "BlockOut" } ] } ```
koalalove
2025年3月8日 20:36
转发文档
收藏文档
上一篇
下一篇
手机扫码
复制链接
手机扫一扫转发分享
复制链接
Markdown文件
分享
链接
类型
密码
更新密码