Since vmess has reported with safety problem. V2fly team started a new protocol called vless.
Today, we are going to teach how to easily install and config it.
I suggest manual install and run it so you will easily solve problem when encountering troubles.
- Using official script to install it by just copying (
bash <(curl -L https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh)
) and press enter!
2, Then run "systemctl enable v2ray
" (it will autorun when system boots) and "systemctl start v2ray
".
3, install caddy2
echo "deb [trusted=yes] https://apt.fury.io/caddy/ /" \ | sudo tee -a /etc/apt/sources.list.d/caddy-fury.list
sudo apt update
sudo apt install caddy
caddy v2 will be auto installed and boots with system starts.
4, Now we need config both v2ray and caddy2.
firstly, nano /etc/caddy/Caddyfile
change Caddyfile and add your domain inside to generate certificates.
then service caddy restart, shortly the new certificates will be generated in
/var/lib/caddy/.local/share/caddy/certificates/acme-v02.api.letsencrypt.org-directory/yourdomian/yourdomian.crt /var/lib/caddy/.local/share/caddy/certificates/acme-v02.api.letsencrypt.org-directory/yourdomian/yourdomian.key
5,Give permission to let v2ray read it. chmod 644 /path/to/certificates
6, Let caddy use only 80 port by removing the domain name and leave only:80
now. service caddy restart
7,config v2ray config.json file with your domain/uuid/certificates
{
"log": {
"loglevel": "warning"
},
"inbounds": [
{
"port": 443,
"protocol": "vless",
"settings": {
"clients": [
{
"id": "", // 填写你的 UUID
"level": 0,
"email": "love@v2fly.org"
}
],
"decryption": "none",
"fallbacks": [
{
"dest": 80
},
{
"path": "/websocket", // 必须换成自定义的 PATH
"dest": 1234,
"xver": 1
}
]
},
"streamSettings": {
"network": "tcp",
"security": "tls",
"tlsSettings": {
"alpn": [
"http/1.1"
],
"certificates": [
{
"certificateFile": "/path/to/fullchain.crt", // 换成你的证书,绝对路径
"keyFile": "/path/to/private.key" // 换成你的私钥,绝对路径
}
]
}
}
},
{
"port": 1234,
"listen": "127.0.0.1",
"protocol": "vless",
"settings": {
"clients": [
{
"id": "", // 填写你的 UUID
"level": 0,
"email": "love@v2fly.org"
}
],
"decryption": "none"
},
"streamSettings": {
"network": "ws",
"security": "none",
"wsSettings": {
"acceptProxyProtocol": true, // 提醒:若你用 Nginx/Caddy 等反代 WS,需要删掉这行
"path": "/websocket" // 必须换成自定义的 PATH,需要和上面的一致
}
}
}
],
"outbounds": [
{
"protocol": "freedom"
}
]
}
8, service v2ray restart .
DONE! enjoy!