From 5c2d78f910347fcba3d54b3b8d71daa3cf9ec1a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=96=E6=9F=92Max?= <60207794+jiuqi9997@users.noreply.github.com> Date: Wed, 9 Jun 2021 12:26:14 +0800 Subject: [PATCH] Xray-1.2.12 (#357) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [fix]修复证书签发与续签 --- config/web.conf | 24 +++++++++++++++++++++++- config/web2.conf | 21 --------------------- install.sh | 15 +++++---------- 3 files changed, 28 insertions(+), 32 deletions(-) delete mode 100644 config/web2.conf diff --git a/config/web.conf b/config/web.conf index 2580508..d84dcce 100644 --- a/config/web.conf +++ b/config/web.conf @@ -7,4 +7,26 @@ server access_log /dev/null; error_log /dev/null; -} \ No newline at end of file +} + +server +{ + listen 127.0.0.1:60000 proxy_protocol; + listen 127.0.0.1:60001 http2 proxy_protocol; + server_name xxx; + index index.html index.htm index.php default.php default.htm default.html; + root /www/xray_web; + add_header Strict-Transport-Security "max-age=63072000" always; + + location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ + { + expires 30d; + error_log off; + } + + location ~ .*\.(js|css)?$ + { + expires 12h; + error_log off; + } +} diff --git a/config/web2.conf b/config/web2.conf deleted file mode 100644 index 2b19f88..0000000 --- a/config/web2.conf +++ /dev/null @@ -1,21 +0,0 @@ -server -{ - listen 127.0.0.1:60000 proxy_protocol; - listen 127.0.0.1:60001 http2 proxy_protocol; - server_name xxx; - index index.html index.htm index.php default.php default.htm default.html; - root /www/xray_web; - add_header Strict-Transport-Security "max-age=63072000" always; - - location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ - { - expires 30d; - error_log off; - } - - location ~ .*\.(js|css)?$ - { - expires 12h; - error_log off; - } -} diff --git a/install.sh b/install.sh index 4742ec6..8d3d365 100644 --- a/install.sh +++ b/install.sh @@ -27,7 +27,7 @@ OK="${Green}[OK]${Font}" ERROR="${Red}[ERROR]${Font}" # 变量 -shell_version="1.2.11" +shell_version="1.2.12" github_branch="main" xray_conf_dir="/usr/local/etc/xray" website_dir="/www/xray_web/" @@ -303,11 +303,8 @@ function modify_tls_version() { function configure_nginx() { nginx_conf="/etc/nginx/conf.d/${domain}.conf" - nginx_conf_2="/etc/nginx/conf.d/${domain}_2.conf" cd /etc/nginx/conf.d/ && rm -f ${domain}.conf && wget -O ${domain}.conf https://raw.githubusercontent.com/wulabing/Xray_onekey/${github_branch}/config/web.conf - cd /etc/nginx/conf.d/ && rm -f ${domain}_2.conf && wget -O ${domain}_2.conf https://raw.githubusercontent.com/wulabing/Xray_onekey/${github_branch}/config/web2.conf - sed -i "/server_name/c \\\tserver_name ${domain};" ${nginx_conf} - sed -i "/server_name/c \\\tserver_name ${domain};" ${nginx_conf_2} + sed -i "s/xxx/${domain}/g" ${nginx_conf} judge "Nginx config modify" systemctl restart nginx @@ -385,12 +382,9 @@ function ssl_install() { function acme() { sed -i "6s/^/#/" "$nginx_conf" + sed -i "6a\\troot $website_dir;" "$nginx_conf" - # 启动 Nginx Xray 并使用 Nginx 配合 acme 进行证书签发 - systemctl restart nginx - systemctl restart xray - - if "$HOME"/.acme.sh/acme.sh --issue -d "${domain}" --nginx -k ec-256 --force; then + if "$HOME"/.acme.sh/acme.sh --issue -d "${domain}" --webroot "$website_dir" -k ec-256 --force; then print_ok "SSL 证书生成成功" sleep 2 if "$HOME"/.acme.sh/acme.sh --installcert -d "${domain}" --fullchainpath /ssl/xray.crt --keypath /ssl/xray.key --reloadcmd "systemctl restart xray" --ecc --force; then @@ -403,6 +397,7 @@ function acme() { exit 1 fi + sed -i "7d" "$nginx_conf" sed -i "6s/#//" "$nginx_conf" }