Xray 服务端搭建配置分享(笔记)
config.ss.json
{
"log": {
"access": "",
"error": "",
"loglevel": "warning"
},
"inbounds": [
{
"port": 8080,
"listen": "0.0.0.0",
"protocol": "shadowsocks",
"settings": {
"method": "2022-blake3-aes-256-gcm",
"password": "7SXhicNYwCDQVqzQZw8xa5me45KAvHl0qgtKZ7TtfbY=",
"network": "tcp,udp",
"level": 0
},
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls"
]
}
}
],
"outbounds": [
{
"protocol": "freedom",
"settings": {}
}
]
}config.vless.reality.json
{
"log": {
"access": "",
"error": "",
"loglevel": "warning"
},
"inbounds": [
{
"port": 8080,
"listen": "0.0.0.0",
"protocol": "vless",
"settings": {
"clients": [
{
"id": "350ff379-b4d1-4e10-839a-edbf05a7e353",
"flow": "xtls-rprx-vision"
}
],
"decryption": "none"
},
"streamSettings": {
"network": "tcp",
"security": "reality",
"realitySettings": {
"show": false,
"xver": 1,
"dest": "aws.amazon.com:443",
"serverNames": [
"aws.amazon.com",
""
],
"publicKey": "Zm9XpXKQ5OQYRZZJNmOSpEM19XfkRLfq66gV-3kNbR4",
"privateKey": "8Krbm8fbJh8Tw3VOMOVJcygRGoYb-ED2SCXYfxtLiR4",
"shortIds": [
""
]
}
},
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls"
]
}
}
],
"outbounds": [
{
"protocol": "freedom",
"settings": {}
}
]
}config.vmess.tcp.http.json
{
"log": {
"access": "",
"error": "",
"loglevel": "warning"
},
"inbounds": [
{
"port": 8080,
"listen": "0.0.0.0",
"protocol": "vmess",
"settings": {
"clients": [
{
"id": "350ff379-b4d1-4e10-839a-edbf05a7e353",
"alterId": 0
}
],
"udp": true,
"allowTransparent": false
},
"streamSettings": {
"network": "tcp",
"tcpSettings": {
"header": {
"type": "http"
}
}
}
},
{
"port": 8081,
"listen": "0.0.0.0",
"protocol": "vmess",
"settings": {
"clients": [
{
"id": "350ff379-b4d1-4e10-839a-edbf05a7e353",
"alterId": 0
}
],
"udp": true,
"allowTransparent": false
},
"streamSettings": {
"network": "tcp",
"tcpSettings": {
"header": {
"type": "http",
"request": {
"method": "GET",
"path": ["/"],
"headers": {
"Host": ["tjdownload.pan.wo.cn"],
"User-Agent": [
"Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36",
"Mozilla/5.0 (iPhone; CPU iPhone OS 10_0_2 like Mac OS X) AppleWebKit/601.1 (KHTML, like Gecko) CriOS/53.0.2785.109 Mobile/14A456 Safari/601.1.46"
],
"Accept-Encoding": ["gzip, deflate"],
"Connection": ["keep-alive"],
"Pragma": "no-cache"
}
}
}
}
}
}
],
"outbounds": [
{
"protocol": "freedom",
"settings": {}
}
]
}config.vmess.tcp.json
{
"log": {
"access": "",
"error": "",
"loglevel": "warning"
},
"inbounds": [
{
"port": 8080,
"listen": "0.0.0.0",
"protocol": "vmess",
"settings": {
"udp": true,
"clients": [
{
"id": "350ff379-b4d1-4e10-839a-edbf05a7e353",
"alterId": 0
}
],
"allowTransparent": false
},
"streamSettings": {
"network": "tcp"
}
}
],
"outbounds": [
{
"protocol": "freedom",
"settings": {}
}
]
}config.vmess.ws.json
{
"log": {
"access": "",
"error": "",
"loglevel": "warning"
},
"inbounds": [
{
"port": 8080,
"protocol": "vmess",
"settings": {
"clients": [
{
"id": "350ff379-b4d1-4e10-839a-edbf05a7e353",
"alterId": 0
}
]
},
"streamSettings": {
"network": "ws",
"wsSettings": {
"path": "/ws"
},
"security": "tls"
}
}
],
"outbounds": [
{
"protocol": "freedom",
"settings": {}
}
]
}config.dokodemo-door.json
{
"log": {
"access": "",
"error": "",
"loglevel": "info"
},
"inbounds": [
{
"listen": "127.0.0.1",
"port": 8080,
"protocol": "dokodemo-door",
"settings": {
"address": "baidu.com",
"port": 443,
"network": "tcp,udp",
"followRedirect": false,
"userLevel": 0
}
}
],
"outbounds": [
{
"protocol": "freedom",
"settings": {}
}
]
}config.alice.json
{
"log": {
"access": "",
"error": "",
"loglevel": "warning"
},
"inbounds": [
{
"tag": "inbound",
"port": 1000,
"listen": "0.0.0.0",
"protocol": "shadowsocks",
"settings": {
"method": "2022-blake3-aes-256-gcm",
"password": "GpgvN5f0Moq5Pjao2jl0+KkZ+ALTHwjb/k8nIyRbGRc=",
"network": "tcp,udp",
"level": 0
},
"sniffing": {
"enabled": true,
"destOverride": ["http", "tls"]
}
},
{
"tag": "inbound-hk",
"port": 20000,
"listen": "0.0.0.0",
"protocol": "shadowsocks",
"settings": {
"method": "2022-blake3-aes-256-gcm",
"password": "GpgvN5f0Moq5Pjao2jl0+KkZ+ALTHwjb/k8nIyRbGRc=",
"network": "tcp,udp",
"level": 0
},
"sniffing": {
"enabled": true,
"destOverride": ["http", "tls"]
}
},
{
"tag": "inbound-tw",
"port": 30000,
"listen": "0.0.0.0",
"protocol": "shadowsocks",
"settings": {
"method": "2022-blake3-aes-256-gcm",
"password": "GpgvN5f0Moq5Pjao2jl0+KkZ+ALTHwjb/k8nIyRbGRc=",
"network": "tcp,udp",
"level": 0
},
"sniffing": {
"enabled": true,
"destOverride": ["http", "tls"]
}
},
{
"tag": "inbound-vn",
"port": 40000,
"listen": "0.0.0.0",
"protocol": "shadowsocks",
"settings": {
"method": "2022-blake3-aes-256-gcm",
"password": "GpgvN5f0Moq5Pjao2jl0+KkZ+ALTHwjb/k8nIyRbGRc=",
"network": "tcp,udp",
"level": 0
},
"sniffing": {
"enabled": true,
"destOverride": ["http", "tls"]
}
},
{
"tag": "inbound-jp",
"port": 50000,
"listen": "0.0.0.0",
"protocol": "shadowsocks",
"settings": {
"method": "2022-blake3-aes-256-gcm",
"password": "GpgvN5f0Moq5Pjao2jl0+KkZ+ALTHwjb/k8nIyRbGRc=",
"network": "tcp,udp",
"level": 0
},
"sniffing": {
"enabled": true,
"destOverride": ["http", "tls"]
}
}
],
"outbounds": [
{
"tag": "outbound",
"protocol": "freedom",
"settings": {}
},
{
"tag": "outbound-hk",
"protocol": "socks",
"settings": {
"servers": [
{
"address": "2a14:67c0:116::1",
"port": 20000,
"users": [{ "user": "alice", "pass": "alicefofo123..OVO" }]
}
]
}
},
{
"tag": "outbound-tw",
"protocol": "socks",
"settings": {
"servers": [
{
"address": "2a14:67c0:116::1",
"port": 30000,
"users": [{ "user": "alice", "pass": "alicefofo123..OVO" }]
}
]
}
},
{
"tag": "outbound-vn",
"protocol": "socks",
"settings": {
"servers": [
{
"address": "2a14:67c0:116::1",
"port": 40000,
"users": [{ "user": "alice", "pass": "alicefofo123..OVO" }]
}
]
}
},
{
"tag": "outbound-jp",
"protocol": "socks",
"settings": {
"servers": [
{
"address": "2a14:67c0:116::1",
"port": 50000,
"users": [{ "user": "alice", "pass": "alicefofo123..OVO" }]
}
]
}
}
],
"routing": {
"domainStrategy": "AsIs",
"rules": [
{
"type": "field",
"inboundTag": ["inbound"],
"outboundTag": "outbound"
},
{
"type": "field",
"inboundTag": ["inbound-hk"],
"outboundTag": "outbound-hk"
},
{
"type": "field",
"inboundTag": ["inbound-tw"],
"outboundTag": "outbound-tw"
},
{
"type": "field",
"inboundTag": ["inbound-vn"],
"outboundTag": "outbound-vn"
},
{
"type": "field",
"inboundTag": ["inbound-jp"],
"outboundTag": "outbound-jp"
}
]
}
}xray 其它命令
安装说明
https://github.com/XTLS/Xray-install/blob/main/README_zh-Hans.md
安装
bash -c "$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)" @ install
卸载
bash -c "$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)" @ remove
开机自启服务
systemctl enable --now xray.service
启动服务
systemctl start xray.service
停止服务
systemctl stop xray.service
生成UUID
xray uuid
生成签名
xray x25519 > key.txt