From 819b15b15e276e130014a6558cece8ea3cf2ae3d Mon Sep 17 00:00:00 2001 From: whyour Date: Tue, 14 Mar 2023 22:39:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=B9=E5=99=A8=E5=A2=9E=E5=8A=A0=20ipv6=20?= =?UTF-8?q?=E6=A3=80=E6=B5=8B=EF=BC=8C=E8=87=AA=E5=8A=A8=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=20nginx?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker/docker-entrypoint.sh | 5 ++--- docker/front.conf | 2 +- shell/check.sh | 4 +--- shell/share.sh | 13 +++++++++++++ 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.sh index 9f1fcbc5..3316d662 100755 --- a/docker/docker-entrypoint.sh +++ b/docker/docker-entrypoint.sh @@ -9,9 +9,8 @@ export isFirstStartServer=true echo -e "======================1. 检测配置文件========================\n" make_dir /etc/nginx/conf.d make_dir /run/nginx -cp -fv $nginx_conf /etc/nginx/nginx.conf -cp -fv $nginx_app_conf /etc/nginx/conf.d/front.conf -sed -i "s,QL_BASE_URL,${qlBaseUrl},g" /etc/nginx/conf.d/front.conf +init_nginx + pm2 l &>/dev/null patch_version &>/dev/null diff --git a/docker/front.conf b/docker/front.conf index c219b20d..5d64a2de 100644 --- a/docker/front.conf +++ b/docker/front.conf @@ -13,7 +13,7 @@ map $http_upgrade $connection_upgrade { server { listen 5700; - listen [::]:5700 ipv6only=on; + IPV6_CONFIG root /ql/static/dist; ssl_session_timeout 5m; diff --git a/shell/check.sh b/shell/check.sh index 3b2c7ed1..09325928 100755 --- a/shell/check.sh +++ b/shell/check.sh @@ -25,9 +25,7 @@ copy_dep() { echo -e "---> 通知文件复制完成\n" echo -e "---> 2. 复制nginx配置文件\n" - cp -fv $nginx_conf /etc/nginx/nginx.conf - cp -fv $nginx_app_conf /etc/nginx/conf.d/front.conf - sed -i "s,QL_BASE_URL,${qlBaseUrl},g" /etc/nginx/conf.d/front.conf + init_nginx echo -e "---> 配置文件复制完成\n" } diff --git a/shell/share.sh b/shell/share.sh index 3d236b29..77b73e54 100755 --- a/shell/share.sh +++ b/shell/share.sh @@ -482,6 +482,19 @@ patch_version() { fi } +init_nginx() { + cp -fv $nginx_conf /etc/nginx/nginx.conf + cp -fv $nginx_app_conf /etc/nginx/conf.d/front.conf + sed -i "s,QL_BASE_URL,${qlBaseUrl},g" /etc/nginx/conf.d/front.conf + + ipv6=$(ip a | grep inet6) + ipv6Str="" + if [[ $ipv6 ]]; then + ipv6Str="listen [::]:5700 ipv6only=on;" + fi + sed -i "s,IPV6_CONFIG,${ipv6Str},g" /etc/nginx/conf.d/front.conf +} + init_env detect_termux detect_macos