dajianjiedian,之前是正常的,在yu名下DNS记录中新增了MX后,Cloudflare中也同步更新了,但不久之后 之前的jiedian无法上网,新增的MX也无法删除。排查了一下,VPS没有问题,域名也没有问题,但出现以下问题:
1.在finalshell中,xray显示main启动失败:无法加载配置文件,
2.x-ui面板系统状态显示“Failed to start: main: failed to load config files: [bin/config.json] > infra/conf: failed to build inbound config with tag inbound-443 > infra/conf: Failed to build TLS config. > common/errors: The feature "verifyPeerCertInNames" has been removed and migrated to "verifyPeerCertByName". Please update your config(s) according to release note and documentation.”
3.xray设置显示错误“Failed to start: main: failed to load config files: [bin/config.json] > infra/conf: failed to build inbound config with tag inbound-443 > infra/conf: Failed to build TLS config. > common/errors: The feature "verifyPeerCertInNames" has been removed and migrated to "verifyPeerCertByName". Please update your config(s) according to release note and documentation.”
不知道该如何解决问题。
finalshell中运行xray显示main启动失败:无法加载配置文件
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-
1条回答 默认 最新
檀越@新空间 2026-02-10 08:38关注上午好☀️☀️☀️️
本答案参考通义千问你遇到的问题是由于 Xray 配置文件中使用了已废弃的配置项
verifyPeerCertInNames,而该配置项在新版本的 Xray 中已被移除,并替换为verifyPeerCertByName。这导致 Xray 在启动时无法加载配置文件,从而出现“main启动失败:无法加载配置文件”的错误。
✅ 问题分析
-
Xray 启动失败:
- 原因:配置文件中存在不兼容的配置项。
- 错误提示明确指出:
The feature "verifyPeerCertInNames" has been removed and migrated to "verifyPeerCertByName"。
-
DNS MX 记录变更后的问题:
- 虽然你提到 VPS 和域名没有问题,但可能与 DNS 解析有关,特别是如果你使用的是 Cloudflare 的 DNS 服务,某些设置(如代理)可能影响到网络连接。
- 但根据你描述的情况,主要问题是 Xray 配置错误,而不是网络或 DNS 本身。
🔧 解决方案
1. 修改 Xray 配置文件中的
verifyPeerCertInNames为verifyPeerCertByName操作步骤:
- 打开 Xray 的配置文件,通常是
bin/config.json或者config.json(取决于你的安装方式)。 - 查找所有包含
verifyPeerCertInNames的配置项。 - 将其替换为
verifyPeerCertByName。
示例修改前(旧配置):
{ "inbounds": [ { "tag": "inbound-443", "protocol": "vless", "settings": { "clients": [ { "id": "your-client-id" } ], "certificates": [ { "leaf": { "certFile": "/path/to/cert.pem", "keyFile": "/path/to/key.pem" }, "verifyPeerCertInNames": ["example.com"] } ] } } ] }修改后(新配置):
{ "inbounds": [ { "tag": "inbound-443", "protocol": "vless", "settings": { "clients": [ { "id": "your-client-id" } ], "certificates": [ { "leaf": { "certFile": "/path/to/cert.pem", "keyFile": "/path/to/key.pem" }, "verifyPeerCertByName": ["example.com"] } ] } } ] }注意: 如果你使用的是 x-ui 等管理面板,请确保配置文件路径正确,且修改后重启 Xray 服务。
2. 重启 Xray 服务
执行以下命令重启 Xray:
systemctl restart xray # 或者 /etc/init.d/xray restart # 根据你的系统和安装方式选择合适的方式
3. 验证 Xray 是否正常运行
systemctl status xray # 或 journalctl -u xray查看日志确认是否仍有错误。
4. 检查 x-ui 面板配置(如有)
如果你使用的是 x-ui 面板,它可能也引用了旧版的配置模板。请检查:
- x-ui 的配置文件(通常位于
/root/x-ui/config.json) - 任何通过 x-ui 添加的配置是否仍然包含
verifyPeerCertInNames
如果有的话,也需要将其替换为
verifyPeerCertByName。
5. 排查 DNS 问题(可选)
虽然你已经确认 VPS 和域名没有问题,但为了彻底排除,可以尝试以下操作:
- 使用
nslookup或dig检查 MX 记录是否解析正确:nslookup yourdomain.com dig MX yourdomain.com - 如果使用 Cloudflare,检查是否启用了 “Proxy”(橙色云图标),关闭后测试是否能正常访问。
📌 总结
| 问题 | 解决方法 | |------|----------| | Xray 启动失败 | 修改配置文件中的
verifyPeerCertInNames为verifyPeerCertByName| | 配置文件错误 | 重新加载或重启 Xray 服务 | | x-ui 面板报错 | 检查并更新 x-ui 的配置文件 | | DNS 问题(可选) | 检查 MX 记录和 Cloudflare 设置 |
🧠 补充建议
- 定期备份配置文件。
- 升级 Xray 前查阅官方 Release Notes。
- 如果你使用的是 x-ui 面板,建议关注其 GitHub 仓库中的更新说明,确保兼容性。
如果你需要我帮你检查具体的配置文件内容,可以将
config.json文件内容粘贴在这里,我可以帮你直接修改。解决 无用评论 打赏 举报-