From a0d611fb4509a3bfcf24b6a8d1c1a37e879063ee Mon Sep 17 00:00:00 2001 From: xiaoshuai Date: Mon, 11 May 2026 11:08:54 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9D=99=E6=80=81=E9=83=A8=E7=BD=B2=E6=94=B9?= =?UTF-8?q?=E9=80=A0=EF=BC=9A=E6=94=B9=E7=94=A8nginx=E7=9B=B4=E6=8E=A5?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E9=9D=99=E6=80=81=E6=96=87=E4=BB=B6=EF=BC=8C?= =?UTF-8?q?=E7=A7=BB=E9=99=A4Node=E8=BF=9B=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Qwen-Coder --- .gitignore | 4 +++- run_prod.sh | 20 +++++++++++--------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index 17be052..fa73678 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,6 @@ docs/.vitepress/cache docs/.vitepress/dist node_modules -package-lock.json \ No newline at end of file +package-lock.json +*.log +nginx*.conf \ No newline at end of file diff --git a/run_prod.sh b/run_prod.sh index 430e8e7..d30d3b5 100644 --- a/run_prod.sh +++ b/run_prod.sh @@ -6,17 +6,19 @@ rm -rf ./node_modules rm -rf ./docs/.vitepress/cache rm -rf ./docs/.vitepress/dist -# 部署静态网页 +# 安装依赖 echo "npm install" npm install -echo "run docs:build" + +# 构建静态文件 +echo "npm run docs:build" npm run docs:build -chown -R www:www ./ -echo "npm run docs:preview" -# 杀掉之前运行的进程 -#ps -ef | grep "npm run docs:preview" | grep -v grep | awk '{print $2}' | xargs kill -9 -netstat -tulpn | grep :1234 | awk '{print $7}' | cut -d '/' -f1 | xargs kill -9 +# 拷贝到目标目录 +echo "copy to /www/xsinfo" +sudo rm -rf /www/xsinfo +sudo mkdir -p /www/xsinfo +sudo cp -r ./docs/.vitepress/dist/* /www/xsinfo/ +sudo chown -R www-data:www-data /www/xsinfo/ -# 以 www 身份后台运行,忽略挂断信号,输出重定向到日志 -nohup sudo -u www npm run docs:preview > /www/wwwroot/xsinfo/preview.log 2>&1 & \ No newline at end of file +echo "done" \ No newline at end of file