#!/bin/bash echo "=== 测试 HTML 文件创建逻辑 ===" # 模拟 start.sh 中的 HTML 创建逻辑 echo "1. 测试 /var/www/html 写入..." mkdir -p /var/www/html 2>/dev/null chmod 755 /var/www/html 2>/dev/null || echo "无法修改 /var/www/html 权限,将使用临时目录" if cat > /var/www/html/test.html 2>/dev/null <<'EOF' Test

Test

EOF then echo "✅ 成功写入 /var/www/html/test.html" WEB_ROOT="/var/www/html" rm -f /var/www/html/test.html else echo "❌ 无法写入 /var/www/html,测试临时目录..." mkdir -p /tmp/www if cat > /tmp/www/test.html <<'EOF' Test

Test

EOF then echo "✅ 成功写入 /tmp/www/test.html" WEB_ROOT="/tmp/www" rm -f /tmp/www/test.html else echo "❌ 无法写入任何位置" exit 1 fi fi echo "2. 选择的 WEB_ROOT: $WEB_ROOT" echo "3. 测试 Nginx 配置生成..." cat > /tmp/test_nginx.conf <