How to set up v2ray server on Ubuntu.
https://github.com/v2fly/fhs-install-v2ray
v2fly
1 2 3 4 5
| // 安裝執行檔和 .dat 資料檔 bash <(curl -L https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh)
// 只更新 .dat 資料檔 bash <(curl -L https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-dat-release.sh)
|
ufw
1 2
| ufw allow http ufw allow https
|
config
1
| vi /usr/local/etc/v2ray/config.json
|
server
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
| { "inbounds": [ { "port": 443, "protocol": "vmess", "settings": { "clients": [ { "id": "899cbb8a-fad2-45bd-8608-8483956d641b", "level": 1, "alterId": 0 } ] }, "streamSettings": { "network": "ws", "security": "tls", "tlsSettings": { "certificates": [ { "certificateFile": "/usr/local/etc/v2ray/songzy.cc.cer", "keyFile": "/usr/local/etc/v2ray/songzy.cc.key" } ] } } } ], "outbounds": [ { "protocol": "freedom", "settings": {} }, { "protocol": "blackhole", "settings": {}, "tag": "blocked" } ] }
|
Note: remember to set the value inbounds.settings.clients.id correctly.
tls (acme.sh)
install
1 2 3
| apt install socat curl https://get.acme.sh | sh source ~/.bashrc
|
register
1
| acme.sh --register-account -m songzy_thu@163.com
|
issue & installcert
1
| acme.sh --issue -d $DOMAIN_NAME --standalone -k ec-256 --debug
|
1
| acme.sh --installcert -d $DOMAIN_NAME --fullchainpath /usr/local/etc/v2ray/$DOMAIN_NAME.cer --keypath /usr/local/etc/v2ray/$DOMAIN_NAME.key --ecc
|
renew
1
| acme.sh --renew -d $DOMAIN_NAME --force --ecc --debug
|
vmess aead
1
| env v2ray.vmess.aead.forced=false /usr/local/bin/v2ray run -config /usr/local/etc/v2ray/config.json
|
ip check
https://www.toolsdaquan.com/ipcheck/