Files
astro-jiao77.cn/deploy.sh
2025-09-29 05:57:18 +08:00

53 lines
1.6 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# 部署到 jiao77.cn 服务器的脚本
# 服务器IP: 110.42.70.70
echo "🚀 开始部署到 jiao77.cn..."
# 检查 dist 目录是否存在
if [ ! -d "dist" ]; then
echo "❌ 错误: dist 目录不存在,请先运行 npm run build"
exit 1
fi
echo "📦 准备上传文件..."
# 使用 rsync 同步文件到服务器
# 您需要根据实际情况修改以下参数:
# - 用户名 (这里假设是 root请根据实际情况修改)
# - Apache 网站根目录 (通常是 /var/www/html)
read -p "请输入服务器用户名 (默认: root): " USERNAME
USERNAME=${USERNAME:-root}
read -p "请输入 Apache 网站根目录路径 (默认: /var/www/jiao77.cn): " WEB_ROOT
WEB_ROOT=${WEB_ROOT:-/var/www/jiao77.cn}
echo "🔄 正在上传文件到服务器..."
# 方法1: 使用 rsync (推荐)
if command -v rsync &> /dev/null; then
echo "使用 rsync 同步文件..."
rsync -avz --delete --progress dist/ ${USERNAME}@110.42.70.70:${WEB_ROOT}/
else
echo "rsync 不可用,使用 scp 上传..."
# 方法2: 使用 scp
scp -r dist/* ${USERNAME}@110.42.70.70:${WEB_ROOT}/
fi
if [ $? -eq 0 ]; then
echo "✅ 部署成功!"
echo "🌐 网站地址: http://jiao77.cn"
echo "🌐 备用地址: http://110.42.70.70"
echo ""
echo "📋 部署后检查清单:"
echo "1. 访问网站确认页面正常显示"
echo "2. 检查所有链接和资源是否正常加载"
echo "3. 测试响应式设计在不同设备上的表现"
echo "4. 验证动画效果是否正常工作"
else
echo "❌ 部署失败,请检查网络连接和服务器配置"
exit 1
fi