记录一次v2ray安装过程

作者: E星期五 分类: SS-R 发布时间: 2021-01-18 23:04 ė 6 没有评论

主要是这类错误,如果出现这条,即表明CAPABILITIES这个有问题ExecStart=/usr/local/bin/v2ray -config /usr/local/etc/v2ray/config.json (code=exited, status=218/CAPABILITIES)

文件在/etc/systemd/system/v2ray.service,删掉CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE

如果修改了User=nobody 还会出现user错误(code=exited, status=217/USER)

出现Could not resolve host: raw.githubusercontent.com; Unknown error这类解析错误,需要增加DNS服务,
/etc/resolv.conf被清空的原因是/etc/sysconfig/network-scripts/ifcfg-eth0中没有dns server信息,所以重启后系统自动使用/etc/sysconfig/network-scripts/ifcfg-eth0中的设置重新设置/etc/resolv.conf,导致修改/etc/resolv.conf无效。只要将/etc/sysconfig/network-scripts/ifcfg-eth0中加入nameserver信息, /etc/resolv.conf根本不用做修改,系统重启或网络重启后会自动根据ifcfg-eth0设置resolv.conf。
知道了原因,彻底解决的方法就有了:打开ifcfg-eth0,在末尾加上下面语句:下面xxx用dns server的地址代替。
DNS1=8.8.8.8
DNS2=8.8.4.4

重启网络服务:service network restart

删掉后运行命令1重新载入、systemctl daemon-reload
2重启v2、service v2ray restart
3查看运行状态、service v2ray status
安装BT,安装Nginx
一键去除注册命令sed -i "s|if (bind_user == 'True') {|if (bind_user == 'REMOVED') {|g" /www/server/panel/BTPanel/static/js/index.js
新建网站,申请SSL,放行23450端口
修改配置文件 location /目录 {
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $http_host;
proxy_intercept_errors on;
if ($http_upgrade = "websocket" ){
proxy_pass http://127.0.0.1:23450; #自定义端口,与下同
}
}

修改/usr/local/etc/v2ray/config.json
{
"log" : {
"access": "/var/log/v2ray/access.log",
"error": "/var/log/v2ray/error.log",
"loglevel": "warning"
},
"inbound": {
"port": 23450, #自动生成的端口,须与Nignx设置的相一致,可自定义
"protocol": "vmess",
"settings": {
"clients": [
{
"id": "id", #自动生成的UUID
"level": 1,
"alterId": 64
}
]
},
"streamSettings": {
"network":"ws",
"wsSettings": {
"path": "/目录", #path可自定义,这里是/ws,须与Nginx和客户端的path相一致
"headers": {
"Host": "域名" #Host可自定于任意域名,此处没有添加
}
}
}
},
"outbound": {
"protocol": "freedom",
"settings": {}
},
"outboundDetour": [
{
"protocol": "blackhole",
"settings": {},
"tag": "blocked"
}
],
"routing": {
"strategy": "rules",
"settings": {
"rules": [
{
"type": "field",
"ip": [
"0.0.0.0/8",
"10.0.0.0/8",
"100.64.0.0/10",
"127.0.0.0/8",
"169.254.0.0/16",
"172.16.0.0/12",
"192.0.0.0/24",
"192.0.2.0/24",
"192.168.0.0/16",
"198.18.0.0/15",
"198.51.100.0/24",
"203.0.113.0/24",
"::1/128",
"fc00::/7",
"fe80::/10"
],
"outboundTag": "blocked"
}
]
}
}
}

本文出自E星期五的博客,转载时请注明出处及相应链接。

本文永久链接: https://exqw.com/archives/1152.html

0

发表评论

邮箱地址不会被公开。 必填项已用*标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据

Ɣ回顶部