申明:V 服务器搭建仅仅只是学习交流使用,不可用作其他用途,
申明: 若有违反论坛规则,请联系本人删除
创建工作目录:
mkdir -p /opt/docker/v3ray/{conf,logs}
(需要系统安装 docker ,docker-compose 运行环境的支持)
工作目录配置文件目录中创建配置文件: config.json
{ "log":{ "access":"/var/log/v3ray/access.log", "error":"/var/log/v3ray/error.log", "loglevel":"warning" }, "dns":{ }, "stats":{ }, "inbounds":[ { "port":7777, "protocol":"vmess", "settings":{ "clients":[ { "id":"8a22acca-2974-4a50-adaa-49f3ff84b072", "alterId":32 } ] }, "tag":"in-0", "streamSettings":{ "network":"tcp", "security":"none", "tcpSettings":{ } } }, { "protocol":"ssr(这里是铭感词汇,自行更换)", "port":8888, "settings":{ "method":"aes-256-gcm", "password":"Asia8888", "udp":false } }, { "tag": "tg-in", "port": 7788, "protocol": "mtproto", "settings": { "users": [{"secret": "b0cbcef5a486c9636472ac27f8e11b9a"}] } } ], "outbounds":[ { "tag":"direct", "protocol":"freedom", "settings":{ } }, { "tag":"blocked", "protocol":"blackhole", "settings":{ } }, { "tag": "tg-out", "protocol": "mtproto", "settings": {} } ], "routing":{ "domainStrategy":"AsIs", "rules":[ { "type":"field", "ip":[ "geoip:private" ], "outboundTag":"blocked" }, { "type": "field", "inboundTag": [ "tg-in" ], "outboundTag": "tg-out" } ] }, "policy":{ }, "reverse":{ }, "transport":{ } }
Docker-compose 模式(推荐):
Dockerfile:
FROM v3ray/official:latest MAINTAINER Alay<chxlay@gmail.com> VOLUME ["/etc/v3ray/","/var/log/v3ray/"] EXPOSE 7777 8888 7788 CMD ["v3ray" ,"-config=/etc/v3ray/config.json"]
运行(不推荐,比较麻烦,没有docker-compose方便):
[root@hongkong ~]# docker run -d --name v3ray --restart=always -v /etc/v3ray:/etc/v3ray -p 7777:7777 -p 8888:8888 v3ray/official v3ray -config=/etc/v3ray/config.json
docker-compose.yml :
version: '3.0' services: behelpfu-v3ray: build: context: ./v3ray dockerfile: Dockerfile restart: always image: behelpfu/v3ray:latest container_name: behelpfu-v3ray ports: - 8888:8888 - 7777:7777 - 7788:7788 volumes: - ./v3ray/conf:/etc/v3ray - ./v3ray/logs:/var/log/v3ray/
启动:docker-compose up (包含了build 和 up)
以上测试中,config.json在conf,Dockerfile,docker-compose.yml 两个文件在同一个路径下,若不在同路劲下,自行修改路径 build 的 content: 和 volumes 挂载路径即可
CentOS 8 开启 BBR,打开sysctl.conf 文件,末尾加入两行
开启 BBR
CentOS 8 开启 BBR,打开sysctl.conf 文件,末尾加入两行,修改 /etc/sysctl.conf 文件即可
[root@HongKong ~]# vi /etc/sysctl.conf
vm.swappiness = 0 kernel.sysrq=1 net.ipv4.neigh.default.gc_stale_time=120 # see details in https://help.aliyun.com/knowledge_detail/39428.html net.ipv4.conf.all.rp_filter=0 net.ipv4.conf.default.rp_filter=0 net.ipv4.conf.default.arp_announce = 2 net.ipv4.conf.lo.arp_announce=2 net.ipv4.conf.all.arp_announce=2 # see details in https://help.aliyun.com/knowledge_detail/41334.html net.ipv4.tcp_max_tw_buckets = 5000 net.ipv4.tcp_syncookies = 1 net.ipv4.tcp_max_syn_backlog = 1024 net.ipv4.tcp_synack_retries = 2 net.core.default_qdisc=fq net.ipv4.tcp_congestion_control=bbr
使之生效: sysctl -p
[root@HongKong ~]# sysctl -p