跳转到内容

SingBox配置

一个代理软件

  • 安装
Terminal window
bash <(curl -fsSL https://sing-box.app/deb-install.sh)
  • 配置参考
/etc/sing-box/config.json
{
"log": {
"disabled": false,
"level": "error",
"output": "/var/log/singbox.log",
"timestamp": true
},
"dns": {},
"ntp": {},
"inbounds": [
{
"type": "naive",
"listen": "::",
"listen_port": 4001,
"users": [
{
"username": "yxy",
"password": "upFrrqjK5g"
}
],
"tls": {
"enabled": true,
"certificate_path": "/usr/local/ssl/fullchain.cer",
"key_path": "/usr/local/ssl/best.key"
},
"tag": "naive_in_old"
},
{
"type": "vmess",
"tag": "vmess_in_old",
"listen": "::",
"listen_port": 4002,
"users": [
{
"uuid": "85b3a1c7-4670-438b-b971-4dbbed3a6c02",
"alterId": 0
}
],
"transport": {
"type": "ws",
"path": "/85b3a1c7-4670-438b-b971-4dbbed3a6c02",
"max_early_data": 2048,
"early_data_header_name": "Sec-WebSocket-Protocol"
},
"tls": {
"enabled": true,
"certificate_path": "/usr/local/ssl/fullchain.cer",
"key_path": "/usr/local/ssl/best.key"
}
},
{
"type": "vless",
"tag": "vless_in_old",
"listen": "::",
"listen_port": 4003,
"users": [
{
"uuid": "85b3a1c7-4670-438b-b971-4dbbed3a6c02"
}
],
"transport": {
"type": "ws",
"path": "/85b3a1c7-4670-438b-b971-4dbbed3a6c02",
"max_early_data": 2048,
"early_data_header_name": "Sec-WebSocket-Protocol"
},
"tls": {
"enabled": true,
"certificate_path": "/usr/local/ssl/fullchain.cer",
"key_path": "/usr/local/ssl/best.key"
}
},
{
"type": "hysteria2",
"tag": "hysteria2_in_old",
"listen": "::",
"listen_port": 4004,
"up_mbps": 100,
"down_mbps": 20,
"users": [
{
"password": "upFrrqjK5g"
}
],
"tls": {
"enabled": true,
"alpn": [
"h3"
],
"certificate_path": "/usr/local/ssl/fullchain.cer",
"key_path": "/usr/local/ssl/best.key"
}
},
{
"type": "hysteria",
"tag": "hysteria_in_old",
"listen": "::",
"listen_port": 4006,
"up_mbps": 100,
"down_mbps": 20,
"users": [
{
"auth_str": "upFrrqjK5g"
}
],
"tls": {
"enabled": true,
"alpn": [
"h3"
],
"certificate_path": "/usr/local/ssl/fullchain.cer",
"key_path": "/usr/local/ssl/best.key"
}
},
{
"type": "trojan",
"tag": "trojan_in_old",
"listen": "::",
"listen_port": 4005,
"users": [
{
"password": "upFrrqjK5g"
}
],
"tls": {
"enabled": true,
"certificate_path": "/usr/local/ssl/fullchain.cer",
"key_path": "/usr/local/ssl/best.key"
},
"multiplex": {
"enabled": true
}
},
{
"type": "naive",
"listen": "::",
"listen_port": 5001,
"users": [
{
"username": "tm",
"password": "pk8G6k9aTGt73d"
}
],
"tls": {
"enabled": true,
"certificate_path": "/usr/local/ssl/fullchain.cer",
"key_path": "/usr/local/ssl/best.key"
},
"tag": "naive_in"
},
{
"type": "vmess",
"tag": "vmess_in",
"listen": "::",
"listen_port": 5002,
"users": [
{
"uuid": "acd09fff-3904-480a-a312-8a9a9b1aaf44",
"alterId": 0
}
],
"transport": {
"type": "ws",
"path": "/demo-account",
"max_early_data": 2048,
"early_data_header_name": "Sec-WebSocket-Protocol"
},
"tls": {
"enabled": true,
"certificate_path": "/usr/local/ssl/fullchain.cer",
"key_path": "/usr/local/ssl/best.key"
}
},
{
"type": "vless",
"tag": "vless_in",
"listen": "::",
"listen_port": 5003,
"users": [
{
"uuid": "acd09fff-3904-480a-a312-8a9a9b1aaf44",
"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": "cAo_sswHagnOKA-VFDek44lvn6b8oU3kaNl2ESgSM1Y",
"short_id": [
""
]
}
}
},
{
"type": "hysteria2",
"tag": "hysteria2_in",
"listen": "::",
"listen_port": 5004,
"up_mbps": 100,
"down_mbps": 20,
"users": [
{
"password": "fV2Qk6tvtB7Mnd2V"
}
],
"tls": {
"enabled": true,
"alpn": [
"h3"
],
"certificate_path": "/usr/local/ssl/fullchain.cer",
"key_path": "/usr/local/ssl/best.key"
}
},
{
"type": "trojan",
"tag": "trojan_in",
"listen": "::",
"listen_port": 5005,
"users": [
{
"password": "BNZije223r3Hmd4D"
}
],
"tls": {
"enabled": true,
"certificate_path": "/usr/local/ssl/fullchain.cer",
"key_path": "/usr/local/ssl/best.key"
},
"multiplex": {
"enabled": true
}
}
],
"endpoints": [],
"outbounds": [
{
"type": "direct",
"tag": "direct_out"
},
{
"type": "socks",
"tag": "socks_out",
"server": "signa-vm1.proxy.truemetrics.cn",
"server_port": 5006,
"version": "5",
"username": "tm",
"password": "chumai2026"
}
],
"route": {
"rules": [
{
"domain_keyword": [
"openai",
"chatgpt",
"gemini",
"claude",
"groq",
"generativeai",
"generativelanguage",
"alkalimakersuite-pa.clients6"
],
"outbound": "socks_out"
}
],
"final": "direct_out"
},
"experimental": {}
}
Terminal window
systemclt status sing-box
systemclt start sing-box
systemclt stop sing-box
systemclt restart sing-box