fenghuo/test-minio-curl.sh

28 lines
1.1 KiB
Bash
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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
echo "🔍 测试MinIO连接..."
# 测试1: 默认凭据
echo -e "\n📱 测试MinIO默认凭据 (minioadmin/minioadmin):"
curl -s -w "HTTP状态码: %{http_code}\n" \
-H "Host: localhost:9000" \
-H "Authorization: AWS minioadmin:signature" \
http://localhost:9000/ | head -5
# 测试2: 无认证访问根路径
echo -e "\n🌐 测试无认证访问:"
curl -s -w "HTTP状态码: %{http_code}\n" http://localhost:9000/ | head -3
# 测试3: 检查MinIO管理界面
echo -e "\n🖥 测试MinIO控制台:"
curl -s -w "HTTP状态码: %{http_code}\n" -I http://localhost:9001/ | grep -E "(HTTP|Server|Content-Type)"
echo -e "\n💡 提示:"
echo "1. 如果你使用Docker运行MinIO检查环境变量MINIO_ROOT_USER和MINIO_ROOT_PASSWORD"
echo "2. 默认凭据通常是 minioadmin/minioadmin"
echo "3. 如果修改了凭据,请更新配置文件"
echo -e "\n🐳 Docker命令参考:"
echo "查看MinIO容器: docker ps | grep minio"
echo "查看容器日志: docker logs <container_name>"
echo "检查环境变量: docker inspect <container_name> | grep -A 10 Env"