又研究了一下ws+tls,其实我也不知道有没有搞出来,也不知道到底效果如何,姑且搞一下…

基本安装#

# 刷新源及更新软件
 sudo apt-get update && sudo apt-get upgrade
# 脚本安装
bash <(curl -L -s https://install.direct/go.sh)
# 编辑 V2Ray 配置
vim /etc/v2ray/config.json

bbr#

wget –no-check-certificate https://github.com/teddysun/across/raw/master/bbr.sh    
chmod +x bbr.sh    
./bbr.sh

域名操作#

注册域名,A 记录指向自己

生成证书,使用 acme.sh 脚本生成

curl  https://get.acme.sh | sh  # 安装到 ~/.acme.sh 目录下
source ~/.bashrc  # 确保脚本所设置的命令别名生效

运行脚本所需工具

sudo apt-get install socat

如果安装报错,那么可能是因为系统缺少 acme.sh 所需要的依赖项sudo apt-get -y install netcat 开始生成证书,注意改成自己的域名

sudo ~/.acme.sh/acme.sh --issue -d mydomain.me --standalone -k ec-256

脚本每隔60天会自动更新,然后手动更新:

sudo ~/.acme.sh/acme.sh --renew -d mydomain.com --force --ecc

将证书和密钥安装到 /etc/v2ray 中

sudo ~/.acme.sh/acme.sh --installcert -d mydomain.me --fullchainpath /etc/v2ray/v2ray.crt --keypath /etc/v2ray/v2ray.key --ecc

升级 acme.sh 到最新版 :

acme.sh --upgrade
# 可以开启自动升级:
acme.sh --upgrade --auto-upgrade
# 关闭自动更新:
acme.sh --upgrade --auto-upgrade 0

nginx#

# ubuntu安装nginx
sudo apt-get install nginx
# 开启nginx
sudo /etc/init.d/nginx start
# 开机自启动
systemctl enable nginx
# 重载nginx
/etc/init.d/nginx reload

检查#

打开域名,看有没有初试welcome界面 测试证书是否正常https://www.ssllabs.com/ssltest/index.html

修改配置#

服务端

{
  "inbounds": [{
    "port": 443,
    "protocol": "vmess",
    "settings": {
      "clients": [
        {
          "id": "cxxxxxxxxaaxx-xxxx-xxxx4-e8e5xxxxxx6xxxx",
          "level": 1,
          "alterId": 4
        }
      ]
    },
     "streamSettings":{
       "network":"ws",
       "security":"tls",
       "tlsSettings":{
         "certificates":[
           {
            "certificateFile": "/etc/v2ray/v2ray.crt",
            "keyFile": "/etc/v2ray/v2ray.key"
                }
]
}
}
  }],
  "outbounds": [{
    "protocol": "freedom",
    "settings": {}
  },{
    "protocol": "blackhole",
    "settings": {},
    "tag": "blocked"
  }],
  "routing": {
    "rules": [
      {
        "type": "field",
        "ip": ["geoip:private"],
        "outboundTag": "blocked"
      }
    ]
  }
}

客户端: 照着填,地址填域名

改进#

目前的nginx还只是一个welcome页面,待搞清楚后再弄吧。

姑且在默认的HTML页面进行了修改。

自动更新似乎不好使,转为手动:

systemctl stop nginx # 先停止占用端口
acme.sh --renew-all