From 77de3b5c4e9a5f6bf7abab925e001d4cf6c65643 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BD=98=E7=BE=BF?= <33997505+paniy@users.noreply.github.com> Date: Thu, 8 Apr 2021 19:34:16 +0800 Subject: [PATCH] Fix BUGs --- README.md | 12 ++++++------ install.sh | 32 +++++++++++++++++++++++--------- 2 files changed, 29 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 7b2a7d9..33205aa 100644 --- a/README.md +++ b/README.md @@ -9,20 +9,21 @@ * 可以直接输入命令:`idleleo` 管理脚本。 * 减少直接访问,隐藏代理域名。 * 访问域名 302 跳转至 https://www.idleleo.com/helloworld (了解配置过程可自行修改)。 -* 阻止 HTTP 接访问服务器 IP 。 +* 阻止 HTTP 直接访问服务器 IP 。 * 使用来自 [@DuckSoft](https://github.com/DuckSoft) 的分享链接[提案](https://github.com/XTLS/Xray-core/issues/91) (beta),支持 Qv2ray、V2rayN、V2rayNG。 * 使用来自 [XTLS](https://github.com/XTLS/Xray-core/issues/158) 项目的提案,遵循 [UUIDv5](https://tools.ietf.org/html/rfc4122#section-4.3) 标准,可以将自定义字符串映射至 VLESS UUID 。 +* 添加负载均衡配置,教程:[XRay进阶玩法 – 搭建后端服务器负载均衡](https://www.idleleo.com/04/5136.html)。 ### Telegram 群组 * Telegram 交流群:https://t.me/idleleo_chat 。 ### 准备工作 * 准备一个域名,并将A记录添加好。 -* [Xray官方说明](https://github.com/XTLS),了解 TLS WebSocket 及 Xray 相关信息。 -* **安装好 wget**。 +* [Xray官方说明](https://xtls.github.io),大概了解 TLS WebSocket XTLS 及 Xray 相关信息。 +* **安装好 wget**,Centos用户运行:`yum install -y wget`;Debian/Ubuntu用户运行:`apt install -y wget`。 ### 安装/更新方式(此为Xray版) -VLESS+Nginx+WebSocket+TLS 或 VLESS+XTLS+Nginx 二选一: +VLESS+Nginx+WebSocket+TLS 或 VLESS+XTLS+Nginx 或 ws ONLY 三选一: ``` wget -N --no-check-certificate -q -O install.sh "https://raw.githubusercontent.com/paniy/Xray_bash_onekey/main/install.sh" && chmod +x install.sh && bash install.sh ``` @@ -39,8 +40,7 @@ wget -N --no-check-certificate -q -O install.sh "https://raw.githubusercontent.c ### 鸣谢 * 本脚本来源于 https://github.com/wulabing/V2Ray_ws-tls_bash_onekey 在此感谢 wulabing * 本脚本中 MTProxy-go TLS 版本项目引用 https://github.com/whunt1/onekeymakemtg 在此感谢 whunt1 -* 本脚本中 锐速4合1脚本原项目引用 https://www.94ish.me/1635.html 在此感谢 -* 本脚本中 锐速4合1脚本修改版项目引用 https://github.com/ylx2016/Linux-NetSpeed 在此感谢 ylx2016 +* 本脚本中 TCP加速 脚本项目引用 https://github.com/ylx2016/Linux-NetSpeed 在此感谢 ylx2016 ### 证书 > 如果你已经拥有了你所使用域名的证书文件,可以将 crt 和 key 文件命名为 xray.crt xray.key 放在 /etc/idleleo/cert 目录下(若目录不存在请先建目录),请注意证书文件权限及证书有效期,自定义证书有效期过期后请自行续签。 diff --git a/install.sh b/install.sh index 7567bc3..fa740e5 100644 --- a/install.sh +++ b/install.sh @@ -33,7 +33,7 @@ Error="${Red}[错误]${Font}" Warning="${Red}[警告]${Font}" # 版本 -shell_version="1.5.4.9" +shell_version="1.5.5.2" shell_mode="None" shell_mode_show="未安装" version_cmp="/tmp/version_cmp.tmp" @@ -314,7 +314,7 @@ nginx_upstream_server_set() { read -rp "请输入负载均衡 地址 (host):" upstream_host read -rp "请输入负载均衡 端口 (port):" upstream_port read -rp "请输入负载均衡 权重 (0~100, 初始值为50):" upstream_weight - sed -i "1a\server ${upstream_host}:${upstream_port} weight=${upstream_weight} max_fails=5 fail_timeout=2;" ${nginx_upstream_conf} + sed -i "1a\\\t\\tserver ${upstream_host}:${upstream_port} weight=${upstream_weight} max_fails=5 fail_timeout=2;" ${nginx_upstream_conf} systemctl restart nginx judge "追加 Nginx 负载均衡" ;; @@ -369,7 +369,7 @@ modify_nginx_other() { sed -i "/server_name/c \\\t\\tserver_name ${domain};" ${nginx_conf} if [[ "$shell_mode" != "xtls" ]]; then sed -i "/location/c \\\tlocation ${camouflage}" ${nginx_conf} - sed -i "/xray-serverc/c \\\t\\t\\tserver 127.0.0.1:${xport} weight=50 max_fails=5 fail_timeout=2;" ${nginx_upstream_conf} + sed -i "/xray-serverc/c \\\t\\tserver 127.0.0.1:${xport} weight=50 max_fails=5 fail_timeout=2;" ${nginx_upstream_conf} fi sed -i "/return/c \\\t\\treturn 301 https://${domain}\$request_uri;" ${nginx_conf} sed -i "/returc/c \\\t\\t\\treturn 302 https://www.idleleo.com/helloworld;" ${nginx_conf} @@ -1092,7 +1092,7 @@ show_information() { ssl_judge_and_install() { if [[ -f "${ssl_chainpath}/xray.key" || -f "${ssl_chainpath}/xray.crt" ]]; then - echo "证书文件已存在" + echo "${GreenBG} 证书文件已存在 ${Font}" echo -e "${GreenBG} 是否删除 [Y/N]? ${Font}" read -r ssl_delete case $ssl_delete in @@ -1106,10 +1106,24 @@ ssl_judge_and_install() { esac fi - if [[ -f "${ssl_chainpath}/xray.key" || -f "${ssl_chainpath}/xray.crt" ]]; then - echo "证书文件已存在" - elif [[ -f "$HOME/.acme.sh/${domain}_ecc/${domain}.key" && -f "$HOME/.acme.sh/${domain}_ecc/${domain}.cer" ]]; then - echo "证书文件已存在" + if [[ -f "$HOME/.acme.sh/${domain}_ecc/${domain}.key" && -f "$HOME/.acme.sh/${domain}_ecc/${domain}.cer" ]]; then + echo -e "${GreenBG} 部分证书文件已存在 ${Font}" + echo -e "${GreenBG} 是否删除 [Y/N]? ${Font}" + read -r ssl_delete_2 + case $ssl_delete_2 in + [yY][eE][sS] | [yY]) + delete_tls_key_and_crt + echo -e "${OK} ${GreenBG} 已删除 ${Font}" + ssl_install + acme + ;; + *) ;; + + esac + elif [[ -f "${ssl_chainpath}/xray.key" || -f "${ssl_chainpath}/xray.crt" ]]; then + echo -e "${GreenBG} 证书文件已存在 ${Font}" + judge "证书应用" + elif [[ ! -f "${ssl_chainpath}/xray.key" || ! -f "${ssl_chainpath}/xray.crt" ]] && [[ -f "$HOME/.acme.sh/${domain}_ecc/${domain}.key" && -f "$HOME/.acme.sh/${domain}_ecc/${domain}.cer" ]]; then "$HOME"/.acme.sh/acme.sh --installcert -d "${domain}" --fullchainpath ${ssl_chainpath}/xray.crt --keypath ${ssl_chainpath}/xray.key --ecc judge "证书应用" else @@ -1400,7 +1414,7 @@ menu() { echo -e "--- authored by paniy ---" echo -e "--- changed by www.idleleo.com ---" echo -e "--- https://github.com/paniy ---\n" - echo -e "当前已安装版本: ${shell_mode_show}\n" + echo -e "当前已安装模式: ${shell_mode_show}\n" idleleo_commend