├── LICENSE ├── README.md ├── config ├── 03_routing.json └── 06_outbounds.json ├── rm_vless.sh ├── start.sh └── vless.sh /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 phlinhng 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # VLESS NGINX 脚本 2 | ~~本脚本为示范性脚本,仅供体验 VLESS 使用。~~
3 | 新脚本已推出,请使用 [@phlinhng/v2ray-tcp-tls-web](https://github.com/phlinhng/v2ray-tcp-tls-web/wiki) 部署 VLESS。
4 | 本脚本将不再维护
5 | 6 | # 使用说明 7 | + 初次使用 8 | ```sh 9 | bash <(curl -sL https://raw.githubusercontent.com/phlinhng/vless-nginx/master/start.sh) && bash ~/vless.sh 10 | ``` 11 | + 再次呼叫 12 | ```sh 13 | bash ~/vless.sh 14 | ``` 15 | 16 | # VLESS 与 VMess 的区别 17 | 1. VMess 为了确保裸连时仍能有效保障安全性和隱蔽性,设计有很多加密运算。在裸连时,那些加密运算能保障传输安全性;然而在 TLS 隧道中,传输层安全由 TLS 保障,此时 Vmess 的加密计算显得冗余且耗费资源。 18 | 2. VLESS 減化了 Vmess 内部的加密机制,以減少计算量以达成降低延迟、提高吞吐量、节约计算成本(例如行动装置耗电量)的效果。 19 | 3. 由于 VLESS 的加密性不如 Vmess,其安全性强依赖 TLS,不建议在不可信通道中单独使用(也就是裸奔)VLESS。 20 | 4. 更多协议细节可参考 [@v2ray/discussion#768](https://github.com/v2ray/discussion/issues/768) 21 | 22 | # 注意事项 23 | 1. 不支持 CDN 24 | 2. 若阁下先前使用过其他的脚本或方式安装过任何形式的代理,请先卸载先前的安装再使用本脚本 25 | 3. 太古老的系统模版可能不相容于新版 V2Ray 和 Nginx,推荐使用 Debian 10 / Ubuntu 18.04 以上系统 26 | 4. VLESS 适配期间,此脚本可能变动频繁,不建议用于生产环境 27 | -------------------------------------------------------------------------------- /config/03_routing.json: -------------------------------------------------------------------------------- 1 | { 2 | "routing": { 3 | "domainStrategy": "AsIs", 4 | "rules": [ 5 | { 6 | "type": "field", 7 | "ip": [ 8 | "geoip:private" 9 | ], 10 | "outboundTag": "blocked" 11 | }, 12 | { 13 | "type": "field", 14 | "protocol": [ 15 | "bittorrent" 16 | ], 17 | "outboundTag": "blocked" 18 | } 19 | ] 20 | } 21 | } -------------------------------------------------------------------------------- /config/06_outbounds.json: -------------------------------------------------------------------------------- 1 | { 2 | "outbounds": [ 3 | { 4 | "tag": "direct", 5 | "protocol": "freedom", 6 | "settings": {} 7 | }, 8 | { 9 | "tag": "blocked", 10 | "protocol": "blackhole", 11 | "settings": {} 12 | } 13 | ] 14 | } -------------------------------------------------------------------------------- /rm_vless.sh: -------------------------------------------------------------------------------- 1 | 2 | #!/bin/bash 3 | export LC_ALL=C 4 | export LANG=C 5 | export LANGUAGE=en_US.UTF-8 6 | 7 | if [[ $(/usr/bin/id -u) -ne 0 ]]; then 8 | sudoCmd="sudo" 9 | else 10 | sudoCmd="" 11 | fi 12 | 13 | #copied & modified from atrandys trojan scripts 14 | #copy from 秋水逸冰 ss scripts 15 | if [[ -f /etc/redhat-release ]]; then 16 | release="centos" 17 | systemPackage="yum" 18 | elif cat /etc/issue | grep -Eqi "debian"; then 19 | release="debian" 20 | systemPackage="apt-get" 21 | elif cat /etc/issue | grep -Eqi "ubuntu"; then 22 | release="ubuntu" 23 | systemPackage="apt-get" 24 | elif cat /etc/issue | grep -Eqi "centos|red hat|redhat"; then 25 | release="centos" 26 | systemPackage="yum" 27 | elif cat /proc/version | grep -Eqi "debian"; then 28 | release="debian" 29 | systemPackage="apt-get" 30 | elif cat /proc/version | grep -Eqi "ubuntu"; then 31 | release="ubuntu" 32 | systemPackage="apt-get" 33 | elif cat /proc/version | grep -Eqi "centos|red hat|redhat"; then 34 | release="centos" 35 | systemPackage="yum" 36 | fi 37 | 38 | # copied from v2ray official script 39 | # colour code 40 | RED="31m" # Error message 41 | GREEN="32m" # Success message 42 | YELLOW="33m" # Warning message 43 | BLUE="36m" # Info message 44 | # colour function 45 | colorEcho() { 46 | echo -e "\033[${1}${@:2}\033[0m" 1>& 2 47 | } 48 | 49 | colorEcho ${BLUE} "Shutting down v2ray service" 50 | ${sudoCmd} systemctl stop v2ray 51 | ${sudoCmd} systemctl disable caddy 52 | ${sudoCmd} rm -f /etc/systemd/system/v2ray.service 53 | ${sudoCmd} rm -f /etc/systemd/system/v2ray.service 54 | ${sudoCmd} rm -f /etc/systemd/system/v2ray@.service 55 | ${sudoCmd} rm -f /etc/systemd/system/v2ray@.service 56 | colorEcho ${BLUE} "Removing v2ray files" 57 | ${sudoCmd} rm -rf /etc/v2ray 58 | ${sudoCmd} rm -rf /usr/local/bin/v2ray 59 | ${sudoCmd} rm -rf /usr/local/bin/v2ctl 60 | ${sudoCmd} rm -rf /usr/local/etc/v2ray 61 | ${sudoCmd} rm -rf /usr/local/lib/v2ray 62 | ${sudoCmd} rm -rf /var/log/v2ray 63 | colorEcho ${BLUE} "Removing v2ray crontab" 64 | ${sudoCmd} crontab -l | grep -v 'v2ray/geoip.dat' | ${sudoCmd} crontab - 65 | ${sudoCmd} crontab -l | grep -v 'v2ray/geosite.dat' | ${sudoCmd} crontab - 66 | colorEcho ${GREEN} "Removed v2ray successfully" 67 | 68 | colorEcho ${BLUE} "Removing dummy site" 69 | ${sudoCmd} rm -rf /var/www/html 70 | 71 | colorEcho ${BLUE} "Removing acme.sh" 72 | ${sudoCmd} rm -rf /root/.acme.sh 73 | ${sudoCmd} crontab -l | grep -v 'acme.sh' | ${sudoCmd} crontab - 74 | 75 | ${sudoCmd} ${systemPackage} remove nginx -y 76 | ${sudoCmd} ${systemPackage} autoremove -y 77 | 78 | ${sudoCmd} rm -f ~/vless.sh 79 | 80 | colorEcho ${GREEN} "卸载完成" -------------------------------------------------------------------------------- /start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | export LC_ALL=C 3 | export LANG=en_US 4 | export LANGUAGE=en_US.UTF-8 5 | 6 | branch="master" 7 | 8 | if [[ $(/usr/bin/id -u) -ne 0 ]]; then 9 | sudoCmd="sudo" 10 | else 11 | sudoCmd="" 12 | fi 13 | 14 | #copied & modified from atrandys trojan scripts 15 | #copy from 秋水逸冰 ss scripts 16 | if [[ -f /etc/redhat-release ]]; then 17 | release="centos" 18 | systemPackage="yum" 19 | #colorEcho ${RED} "unsupported OS" 20 | #exit 0 21 | elif cat /etc/issue | grep -Eqi "debian"; then 22 | release="debian" 23 | systemPackage="apt-get" 24 | elif cat /etc/issue | grep -Eqi "ubuntu"; then 25 | release="ubuntu" 26 | systemPackage="apt-get" 27 | elif cat /etc/issue | grep -Eqi "centos|red hat|redhat"; then 28 | release="centos" 29 | systemPackage="yum" 30 | #colorEcho ${RED} "unsupported OS" 31 | #exit 0 32 | elif cat /proc/version | grep -Eqi "debian"; then 33 | release="debian" 34 | systemPackage="apt-get" 35 | elif cat /proc/version | grep -Eqi "ubuntu"; then 36 | release="ubuntu" 37 | systemPackage="apt-get" 38 | elif cat /proc/version | grep -Eqi "centos|red hat|redhat"; then 39 | release="centos" 40 | systemPackage="yum" 41 | #colorEcho ${RED} "unsupported OS" 42 | #exit 0 43 | fi 44 | 45 | # install requirements 46 | ${sudoCmd} ${systemPackage} update 47 | ${sudoCmd} ${systemPackage} install software-properties-common -y -q 48 | ${sudoCmd} add-apt-repository ppa:ondrej/nginx-mainline -y 49 | ${sudoCmd} ${systemPackage} update 50 | ${sudoCmd} ${systemPackage} install wget coreutils nginx-extras unzip -y -q 51 | ${sudoCmd} ${systemPackage} install nginx -y -q -f 52 | 53 | # set time syncronise service 54 | ${sudoCmd} timedatectl set-ntp true 55 | 56 | ${sudoCmd} wget -q -N https://raw.githubusercontent.com/phlinhng/vless-nginx/${branch}/vless.sh -O ~/vless.sh -------------------------------------------------------------------------------- /vless.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | export LC_ALL=C 3 | export LANG=en_US 4 | export LANGUAGE=en_US.UTF-8 5 | 6 | branch="master" 7 | 8 | if [[ $(/usr/bin/id -u) -ne 0 ]]; then 9 | sudoCmd="sudo" 10 | else 11 | sudoCmd="" 12 | fi 13 | 14 | # copied from v2ray official script 15 | # colour code 16 | RED="31m" # Error message 17 | GREEN="32m" # Success message 18 | YELLOW="33m" # Warning message 19 | BLUE="36m" # Info message 20 | # colour function 21 | colorEcho(){ 22 | echo -e "\033[${1}${@:2}\033[0m" 1>& 2 23 | } 24 | 25 | red="\033[0;${RED}" 26 | green="\033[0;${GREEN}" 27 | nocolor="\033[0m" 28 | 29 | #copied & modified from atrandys trojan scripts 30 | #copy from 秋水逸冰 ss scripts 31 | if [[ -f /etc/redhat-release ]]; then 32 | release="centos" 33 | systemPackage="yum" 34 | #colorEcho ${RED} "unsupported OS" 35 | #exit 0 36 | elif cat /etc/issue | grep -Eqi "debian"; then 37 | release="debian" 38 | systemPackage="apt-get" 39 | elif cat /etc/issue | grep -Eqi "ubuntu"; then 40 | release="ubuntu" 41 | systemPackage="apt-get" 42 | elif cat /etc/issue | grep -Eqi "centos|red hat|redhat"; then 43 | release="centos" 44 | systemPackage="yum" 45 | #colorEcho ${RED} "unsupported OS" 46 | #exit 0 47 | elif cat /proc/version | grep -Eqi "debian"; then 48 | release="debian" 49 | systemPackage="apt-get" 50 | elif cat /proc/version | grep -Eqi "ubuntu"; then 51 | release="ubuntu" 52 | systemPackage="apt-get" 53 | elif cat /proc/version | grep -Eqi "centos|red hat|redhat"; then 54 | release="centos" 55 | systemPackage="yum" 56 | #colorEcho ${RED} "unsupported OS" 57 | #exit 0 58 | fi 59 | 60 | VERSION="0.4" 61 | 62 | continue_prompt() { 63 | read -rp "继续其他操作 (yes/no)? " choice 64 | case "${choice}" in 65 | [yY]|[yY][eE][sS] ) return 0 ;; 66 | * ) exit 0;; 67 | esac 68 | } 69 | 70 | checkIP() { 71 | local realIP="$(curl -s `curl -s https://raw.githubusercontent.com/phlinhng/v2ray-tcp-tls-web/master/custom/ip_api`)" 72 | local resolvedIP="$(ping $1 -c 1 | head -n 1 | grep -oE '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+' | head -n 1)" 73 | 74 | if [[ "${realIP}" == "${resolvedIP}" ]]; then 75 | return 0 76 | else 77 | return 1 78 | fi 79 | } 80 | 81 | get_v2ray() { 82 | curl -sL https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh | ${sudoCmd} bash 83 | } 84 | 85 | build_v2ray_service() { 86 | ${sudoCmd} cat > "/etc/systemd/system/v2ray.service" <<-EOF 87 | [Unit] 88 | Description=V2Ray Service 89 | After=network.target nss-lookup.target 90 | [Service] 91 | User=nobody 92 | CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE 93 | AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE 94 | NoNewPrivileges=true 95 | Environment=V2RAY_LOCATION_ASSET=/usr/local/share/v2ray/ 96 | ExecStart=/usr/local/bin/v2ray -confdir /usr/local/etc/v2ray 97 | Restart=on-failure 98 | [Install] 99 | WantedBy=multi-user.target 100 | EOF 101 | ${sudoCmd} systemctl daemon-reload 102 | ${sudoCmd} systemctl enable v2ray 103 | } 104 | 105 | set_vless() { 106 | ${sudoCmd} cat > "/usr/local/etc/v2ray/05_inbounds.json" <<-EOF 107 | { 108 | "inbounds": [ 109 | { 110 | "port": 443, 111 | "protocol": "vless", 112 | "settings": { 113 | "clients": [ 114 | { 115 | "id": "$1" 116 | } 117 | ], 118 | "decryption": "none", 119 | "fallbacks": [ 120 | { 121 | "dest": 80 122 | } 123 | ] 124 | }, 125 | "streamSettings": { 126 | "network": "tcp", 127 | "security": "tls", 128 | "tlsSettings": { 129 | "alpn": [ "http/1.1" ], 130 | "certificates": [ 131 | { 132 | "certificateFile": "/etc/ssl/v2ray/fullchain.pem", 133 | "keyFile": "/etc/ssl/v2ray/key.pem" 134 | } 135 | ] 136 | } 137 | }, 138 | "sniffing": { 139 | "enabled": true, 140 | "destOverride": [ "http", "tls" ] 141 | } 142 | } 143 | ] 144 | } 145 | EOF 146 | wget -q https://raw.githubusercontent.com/phlinhng/vless-nginx/${branch}/config/03_routing.json -O /usr/local/etc/v2ray/03_routing.json 147 | wget -q https://raw.githubusercontent.com/phlinhng/vless-nginx/${branch}/config/06_outbounds.json -O /usr/local/etc/v2ray/06_outbounds.json 148 | } 149 | 150 | build_web() { 151 | if [ ! -f "/var/www/html/index.html" ]; then 152 | # choose and copy a random template for dummy web pages 153 | local template="$(curl -s https://raw.githubusercontent.com/phlinhng/web-templates/master/list.txt | shuf -n 1)" 154 | wget -q https://raw.githubusercontent.com/phlinhng/web-templates/master/${template} -O /tmp/template.zip 155 | ${sudoCmd} mkdir -p /var/www/html 156 | ${sudoCmd} unzip -q /tmp/template.zip -d /var/www/html 157 | ${sudoCmd} wget -q https://raw.githubusercontent.com/phlinhng/v2ray-tcp-tls-web/${branch}/custom/robots.txt -O /var/www/html/robots.txt 158 | else 159 | echo "Dummy website existed. Skip building." 160 | fi 161 | } 162 | 163 | set_redirect() { 164 | ${sudoCmd} cat > /etc/nginx/sites-available/default <<-EOF 165 | server { 166 | listen 80 default_server; 167 | listen [::]:80 default_server; 168 | server_name _; 169 | return 301 https://\$host\$request_uri; 170 | } 171 | EOF 172 | } 173 | 174 | set_nginx() { 175 | ${sudoCmd} rm /etc/nginx/sites-enabled/vless_fallback.conf 176 | ${sudoCmd} cat > /etc/nginx/sites-available/vless_fallback.conf <<-EOF 177 | server { 178 | listen 127.0.0.1:80; 179 | server_name $1; 180 | root /var/www/html; 181 | index index.php index.html index.htm; 182 | } 183 | EOF 184 | ${sudoCmd} cd /etc/nginx/sites-enabled 185 | ${sudoCmd} ln -s /etc/nginx/sites-available/vless_fallback.conf . 186 | ${sudoCmd} cd ~ 187 | } 188 | 189 | install_vless() { 190 | while true; do 191 | read -rp "解析到本 VPS 的域名: " V2_DOMAIN 192 | if checkIP "${V2_DOMAIN}"; then 193 | colorEcho ${GREEN} "域名 ${V2_DOMAIN} 解析正确, 即将开始安装" 194 | break 195 | else 196 | colorEcho ${RED} "域名 ${V2_DOMAIN} 解析有误 (yes: 强制继续, no: 重新输入, quit: 离开)" 197 | read -rp "若您确定域名解析正确, 可以继续进行安装作业. 强制继续? (yes/no/quit) " forceConfirm 198 | case "${forceConfirm}" in 199 | [yY]|[yY][eE][sS] ) break ;; 200 | [qQ]|[qQ][uU][iI][tT] ) return 0 ;; 201 | esac 202 | fi 203 | done 204 | 205 | # install requirements 206 | ${sudoCmd} ${systemPackage} update 207 | ${sudoCmd} ${systemPackage} install software-properties-common -y -q 208 | ${sudoCmd} add-apt-repository ppa:ondrej/nginx-mainline -y 209 | ${sudoCmd} ${systemPackage} update 210 | ${sudoCmd} ${systemPackage} install wget coreutils nginx-extras unzip -y -q 211 | ${sudoCmd} ${systemPackage} install nginx -y -q -f 212 | 213 | # install v2ray-core 214 | get_v2ray 215 | 216 | # edit v2ray.service for confdir 217 | build_v2ray_service 218 | 219 | # configurate vless 220 | colorEcho ${BLUE} "Setting VLESS" 221 | local uuid_vless="$(cat '/proc/sys/kernel/random/uuid')" 222 | set_vless "${uuid_vless}" 223 | 224 | # fetch geoip.dat and geosite.dat 225 | ${sudoCmd} mkdir -p /usr/local/share/v2ray 226 | ${sudoCmd} wget -q https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/geoip.dat -O /usr/local/share/v2ray/geoip.dat 227 | ${sudoCmd} wget -q https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/geosite.dat -O /usr/local/share/v2ray/geosite.dat 228 | 229 | # set crontab to auto update geoip.dat and geosite.dat 230 | (crontab -l 2>/dev/null; echo "0 7 * * * wget -q https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/geoip.dat -O /usr/local/share/v2ray/geoip.dat >/dev/null >/dev/null") | ${sudoCmd} crontab - 231 | (crontab -l 2>/dev/null; echo "0 7 * * * wget -q https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/geosite.dat -O /usr/local/share/v2ray/geosite.dat >/dev/null >/dev/null") | ${sudoCmd} crontab - 232 | 233 | ${sudoCmd} mkdir -p /etc/ssl/v2ray 234 | 235 | # building dummy website 236 | colorEcho ${BLUE} "Building dummy web site" 237 | build_web 238 | 239 | # temporary config for issuing certs 240 | ${sudoCmd} cat > /etc/nginx/sites-enabled/vless_fallback.conf <<-EOF 241 | server { 242 | listen 80; 243 | server_name ${V2_DOMAIN}; 244 | root /var/www/html; 245 | index index.php index.html index.htm; 246 | } 247 | EOF 248 | 249 | ${sudoCmd} systemctl restart nginx 250 | 251 | # get acme.sh 252 | colorEcho ${BLUE} "Installing acme.sh" 253 | curl -fsSL https://get.acme.sh | ${sudoCmd} sh 254 | 255 | # issue certificate 256 | # get certificate before restarting nginx to avoid failure while issuing 257 | colorEcho ${BLUE} "Issuing certificate" 258 | ${sudoCmd} /root/.acme.sh/acme.sh --issue --nginx -d "${V2_DOMAIN}" --keylength ec-256 259 | 260 | # install certificate 261 | colorEcho ${BLUE} "Installing certificate" 262 | ${sudoCmd} /root/.acme.sh/acme.sh --install-cert --ecc -d "${V2_DOMAIN}" \ 263 | --key-file /etc/ssl/v2ray/key.pem --fullchain-file /etc/ssl/v2ray/fullchain.pem \ 264 | --reloadcmd "chmod 644 /etc/ssl/v2ray/fullchain.pem; chmod 644 /etc/ssl/v2ray/key.pem; systemctl daemon-reload; systemctl restart v2ray" 265 | 266 | # configurate nginx for fallback 267 | set_redirect 268 | set_nginx "${V2_DOMAIN}" 269 | 270 | colorEcho ${BLUE} "Activating services" 271 | ${sudoCmd} systemctl daemon-reload 272 | ${sudoCmd} systemctl reset-failed 273 | ${sudoCmd} systemctl enable v2ray 274 | ${sudoCmd} systemctl restart v2ray 2>/dev/null ## restart v2ray to enable new config 275 | ${sudoCmd} systemctl enable nginx 276 | ${sudoCmd} systemctl restart nginx 277 | 278 | colorEcho ${GREEN} "安装 VLESS+NGINX 成功!" 279 | 280 | echo "" 281 | echo "${V2_DOMAIN}:443" 282 | echo "${uuid_vless}" && echo "" 283 | } 284 | 285 | get_cert() { 286 | while true; do 287 | read -rp "解析到本 VPS 的域名: " V2_DOMAIN 288 | if checkIP "${V2_DOMAIN}"; then 289 | colorEcho ${GREEN} "域名 ${V2_DOMAIN} 解析正确, 即将开始安装" 290 | break 291 | else 292 | colorEcho ${RED} "域名 ${V2_DOMAIN} 解析有误 (yes: 强制继续, no: 重新输入, quit: 离开)" 293 | read -rp "若您确定域名解析正确, 可以继续进行安装作业. 强制继续? (yes/no/quit) " forceConfirm 294 | case "${forceConfirm}" in 295 | [yY]|[yY][eE][sS] ) break ;; 296 | [qQ]|[qQ][uU][iI][tT] ) return 0 ;; 297 | esac 298 | fi 299 | done 300 | 301 | colorEcho ${BLUE} "Issuing certificate" 302 | ${sudoCmd} /root/.acme.sh/acme.sh --issue --nginx -d "${V2_DOMAIN}" --keylength ec-256 303 | 304 | # install certificate 305 | colorEcho ${BLUE} "Installing certificate" 306 | ${sudoCmd} /root/.acme.sh/acme.sh --install-cert --ecc -d "${V2_DOMAIN}" \ 307 | --key-file /etc/ssl/v2ray/key.pem --fullchain-file /etc/ssl/v2ray/fullchain.pem \ 308 | --reloadcmd "chmod 644 /etc/ssl/v2ray/fullchain.pem; chmod 644 /etc/ssl/v2ray/key.pem; systemctl daemon-reload; systemctl restart v2ray" 309 | 310 | set_nginx "${V2_DOMAIN}" 311 | 312 | ${sudoCmd} systemctl daemon-reload 313 | ${sudoCmd} systemctl reset-failed 314 | ${sudoCmd} systemctl enable v2ray 315 | ${sudoCmd} systemctl restart v2ray 2>/dev/null ## restart v2ray to enable new config 316 | ${sudoCmd} systemctl enable nginx 317 | ${sudoCmd} systemctl restart nginx 318 | 319 | colorEcho ${GREEN} "更新证书成功!" 320 | } 321 | 322 | vps_tools() { 323 | ${sudoCmd} ${systemPackage} install wget -y -qq 324 | wget -q https://raw.githubusercontent.com/phlinhng/v2ray-tcp-tls-web/${branch}/tools/vps_tools.sh -O /tmp/vps_tools.sh && chmod +x /tmp/vps_tools.sh && ${sudoCmd} /tmp/vps_tools.sh 325 | exit 0 326 | } 327 | 328 | rm_vless() { 329 | ${sudoCmd} ${systemPackage} install curl -y -qq 330 | curl -sL https://raw.githubusercontent.com/phlinhng/vless-nginx/${branch}/rm_vless.sh | bash 331 | exit 0 332 | } 333 | 334 | show_menu() { 335 | echo "" 336 | echo "----------基础操作----------" 337 | echo "0) 安装 VLESS+NGINX" 338 | echo "1) 更新 v2ray-core" 339 | echo "----------管理工具----------" 340 | echo "2) 修复证书/更换域名" 341 | echo "3) VPS 工具" 342 | echo "4) 卸载脚本" 343 | echo "" 344 | } 345 | 346 | menu() { 347 | colorEcho ${YELLOW} "VLESS automated script v${VERSION}" 348 | colorEcho ${YELLOW} "author: phlinhng" 349 | 350 | #check_status 351 | 352 | COLUMNS=woof 353 | 354 | while true; do 355 | show_menu 356 | read -rp "选择操作 [输入任意值退出]: " opt 357 | case "${opt}" in 358 | "0") install_vless && continue_prompt ;; 359 | "1") get_v2ray && continue_prompt ;; 360 | "2") get_cert && continue_prompt ;; 361 | "3") vps_tools ;; 362 | "4") rm_vless ;; 363 | *) break ;; 364 | esac 365 | done 366 | 367 | } 368 | 369 | menu 370 | --------------------------------------------------------------------------------