【操作记录】bwh vps 脚本安装记录
工具:
winscp,putty
系统推荐安装CentOS7-bbr 或者 UbuntuServer 20.04 (已自带bbr)
查看bbr 模块:
lsmod | grep bbr
流程:
1. 安装v2,使用官方脚本:
请到 https://github.com/v2fly/ 内下载
默认配置文件在 /usr/local/etc 文件夹里的 config.json
配置参考(websocket+vmess,tls支持在后面的caddy里配置)
{ "log": { "loglevel": "warning" }, "routing": { "domainStrategy": "AsIs", "rules": [ { "type": "field", "ip": [ "geoip:private" ], "outboundTag": "block" } ] }, "inbounds": [ { "listen": "0.0.0.0", "port": 8080, "protocol": "vmess", "settings": { "clients": [ { "id": "这里的id可在客户端或在线工具生成", "level": 1, "alterId": 64 } ] }, "streamSettings": { "network": "ws", "security": "none", "wsSettings": { "path": "/api" } } } ], "outbounds": [ { "protocol": "freedom", "tag": "direct" }, { "protocol": "blackhole", "tag": "block" } ] }
保存后,重启v2即可。
2. 安装caddy,同样是官方脚本:
sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo tee /etc/apt/trusted.gpg.d/caddy-stable.asc curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list sudo apt update sudo apt install caddy
默认配置在:/etc/caddy/Caddyfile
和上面的v2配合使用,tls + websocket代理,配置举例:
v2.caddy.com { root * /usr/local/etc/www tls v2@caddy.com file_server reverse_proxy /api 127.0.0.1:8080 handle_errors { rewrite * 404.html file_server } }
也可以在外面再套一层CDN(比如CF),这时候可以关闭caddy的https,只用CDN提供的HTTPS支持
方法是域名指定http协议,配置举例:
http://cf.caddy.com { file_server reverse_proxy /api 127.0.0.1:8080 handle_errors { rewrite * 404.html file_server } }
然后重启caddy即可