步骤 1:创建配置目录 在终端中执行以下命令,创建Clash的配置目录: mkdir -p ~/.config/clash/ 步骤 2:新建配置文件 使用文本编辑器(如 nano 或 vim)打开配置文件: nano ~/.config/clash/config.json 步骤 3:填写配置内容 在编辑器中输入以下内容,替换为你的订阅链接和节点配置: { "sub": "https://gitea.com/clash/clash?from=master", "update": "https://gitea.com/clash/clash-update?from=master", "nodes": [ { "name": "我的节点1", "url": "http://localhost:789", "port": 789, "max-connections": 100, "max-downloads": 200, "min-downloads": 100, "enable-ping": true, "enable-legacy": true } ] } 步骤 4:保存并应用配置 按下 Ctrl + O 保存文件,然后退出编辑器(Ctrl + X 或 wq)。 步骤 5:重启Clash服务 在终端中执行以下命令,重启Clash服务: clash-service restart 步骤 6:验证配置(可选) 检查Clash的日志或输出,确保订阅和更新链接有效,并且节点配置正确,可以运行: clash-service status 示例:添加国内节点 如果你想增加国内节点的下载速度,可以在 nodes 数组中添加另一个节点: { "sub&qu...
步骤 1:创建配置目录
在终端中执行以下命令,创建Clash的配置目录:
mkdir -p ~/.config/clash/
步骤 2:新建配置文件
使用文本编辑器(如 nano 或 vim)打开配置文件:
nano ~/.config/clash/config.json
步骤 3:填写配置内容
在编辑器中输入以下内容,替换为你的订阅链接和节点配置:
{
"sub": "https://gitea.com/clash/clash?from=master",
"update": "https://gitea.com/clash/clash-update?from=master",
"nodes": [
{
"name": "我的节点1",
"url": "http://localhost:789",
"port": 789,
"max-connections": 100,
"max-downloads": 200,
"min-downloads": 100,
"enable-ping": true,
"enable-legacy": true
}
]
}
步骤 4:保存并应用配置
按下 Ctrl + O 保存文件,然后退出编辑器(Ctrl + X 或 wq)。
步骤 5:重启Clash服务
在终端中执行以下命令,重启Clash服务:
clash-service restart
步骤 6:验证配置(可选)
检查Clash的日志或输出,确保订阅和更新链接有效,并且节点配置正确,可以运行:
clash-service status
示例:添加国内节点
如果你想增加国内节点的下载速度,可以在 nodes 数组中添加另一个节点:
{
"sub": "https://gitea.com/clash/clash?from=master",
"update": "https://gitea.com/clash/clash-update?from=master",
"nodes": [
{
"name": "国内节点1",
"url": "http://localhost:789",
"port": 789,
"max-connections": 100,
"max-downloads": 200,
"min-downloads": 100,
"enable-ping": true,
"enable-legacy": true
},
{
"name": "我的节点2",
"url": "http://localhost:7891",
"port": 7891,
"max-connections": 100,
"max-downloads": 200,
"min-downloads": 100,
"enable-ping": true,
"enable-legacy": true
}
]
}
注意事项
- 确保订阅链接和更新链接正确无误。
- 调整节点的
max-connections和max-downloads根据你的网络带宽和需求。 enable-ping可以激活节点在线检测,enable-legacy可能有特定的功能。- 如果遇到错误,检查JSON格式和节点配置是否正确。
完成以上步骤后,Clash 应该能够正常订阅更新,并使用配置好的节点。

相关文章








