常见问题

常见问题

安装与部署

安装向导无法连接数据库

  • 确认数据库服务已启动
  • 检查 host、port、username、password 是否正确
  • MySQL 用户需要有创建表和写入数据的权限

Redis 连接失败

  • 确认 Redis 服务已启动:redis-cli ping 应返回 PONG
  • 检查 host、port、password 配置

端口 8080 被占用

修改 config.yaml 中的监听地址:

server:
  addr: ":9090"

SQLite 能否用于生产环境?

不推荐。SQLite 适合个人使用和快速体验,生产环境建议使用 MySQL 或 PostgreSQL。

配置相关

修改配置后不生效

系统支持配置热重载:

kill -HUP $(pgrep mliev-iam)
# 或
curl -X GET http://localhost:8080/api/system/reload

反向代理下 OIDC 报错

OIDC issuer 必须匹配外部访问 URL:

oidc:
  issuer: "https://auth.example.com"

确保 Nginx 传递头部:

proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host;

OIDC 相关

错误 原因 解决方案
invalid_client 客户端 ID/密钥错误 检查 client_id 和 client_secret
invalid_grant 授权码过期或已使用 默认 10 分钟有效,一次性使用
invalid_scope 作用域无效 确保包含 openid,且在允许范围内
invalid_redirect_uri 回调地址不匹配 URI 必须完全匹配注册列表

日志与调试

修改日志级别:

log:
  level: debug

开发模式启动:

mode=debug go run .
# 或
make dev-go