修改配置文件重启服务报错
cheneyxx opened this issue · 4 comments
"log": {
"loglevel": "warning",
"access": "/usr/local/etc/xray/access.log",
"error": "/usr/local/etc/xray/error.log"
},
我想要查看访问信息 加了上面两行重启xray后会报错
你要发你的配置,报错信息用查看日志那命令,发上来,才能分析
journalctl -u xray --output cat -f
Failed to start: main: failed to create server > app/log: failed to initialize access logger > open /usr/local/etc/xray/access.log: permission denied
xray.service: Main process exited, code=exited, status=23/n/a
xray.service: Failed with result 'exit-code'.
Started Xray Service.
Xray 1.7.5 (Xray, Penetrates Everything.) Custom (go1.20 linux/amd64)
A unified platform for anti-censorship.
2023/07/26 21:17:22 [Info] infra/conf/serial: Reading config: /usr/local/etc/xray/config.json
Failed to start: main: failed to create server > app/log: failed to initialize access logger > open /usr/local/etc/xray/access.log: permission denied
xray.service: Main process exited, code=exited, status=23/n/a
xray.service: Failed with result 'exit-code'.
{
"log": {
"loglevel": "warning",
"access": "/usr/local/etc/xray/access.log",
"error": "/usr/local/etc/xray/error.log"
},
"routing": {
"domainStrategy": "IPIfNonMatch",
"rules": [
{
"type": "field",
"port": "443",
"network": "udp",
"outboundTag": "block"
},
{
"type": "field",
"ip": [
"geoip:cn",
"geoip:private"
],
"outboundTag": "block"
},
{
"type": "field",
"domain": [
"geosite:steam",
"geosite:origin",
"geosite:xbox",
"geosite:meituan",
"geosite:tencent"
],
"outboundTag": "block"
},
{
"type": "field",
"protocol": [
"bittorrent"
],
"outboundTag": "block"
}
]
},
"inbounds": [
{
"listen": "0.0.0.0", // "0.0.0.0" 表示同时监听IPv4和IPv6
"port": 443, // 服务端监听的端口
"protocol": "vless",
"settings": {
"clients": [
{
"id": "password", // 用户ID,执行 xray uuid 生成,或 1-30 字节的字符串
"flow": "xtls-rprx-vision"
}
],
"decryption": "none",
"fallbacks": [
{
"dest": "8001",
"xver": 1
},
{
"alpn": "h2",
"dest": "8002",
"xver": 1
}
]
},
"streamSettings": {
"network": "tcp",
"security": "tls",
"tlsSettings": {
"rejectUnknownSni": true,
"minVersion": "1.2",
"certificates": [ // 证书文件需要使用fullchain(全SSL证书链),若只包含网站证书,会出现如v2rayN能通,v2rayNG不通的现象
{
"ocspStapling": 3600,
"certificateFile": "/etc/ssl/private/fullchain.cer", // 证书文件,通常不区分扩展名
"keyFile": "/etc/ssl/private/private.key" // 私钥文件,通常不区分扩展名
}
]
}
},
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls",
"quic"
]
}
}
],
"outbounds": [
{
"protocol": "freedom",
"tag": "direct"
},
{
"protocol": "blackhole",
"tag": "block"
}
],
"policy": {
"levels": {
"0": {
"handshake": 2, // 连接建立时的握手时间限制,单位为秒,默认值为 4,建议与默认值不同
"connIdle": 120 // 连接空闲的时间限制,单位为秒,默认值为 300,建议与默认值不同
}
}
}
}
Failed to start: main: failed to create server > app/log: failed to initialize access logger > open /usr/local/etc/xray/access.log: permission denied
如果你不是安装是加了 -root 参数,xray默认安出来是nobody用户,日志默认用在这目录下面
"log": {
"access": "/var/log/xray/access.log",
"error": "/var/log/xray/error.log",
"loglevel": "warning",
"dnsLog": false
},