# MaxMind 401 错误 -- 有许可证密钥，无法下载

**URL:** https://meta.discourse.org/t/maxmind-401-error-have-license-key-cant-download/388284
**Category:** Self-hosting
**Tags:** maxmind
**Created:** [2025年十一月12日 17:07 UTC](https://meta.discourse.org/t/maxmind-401-error-have-license-key-cant-download/388284 "2025-11-12T17:07:13Z")
**Posts on this page:** 1
**Showing post:** 1

<div class="post-metadata">

### Author: ![ToddZ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/toddz/32/328350_2.png) [@ToddZ](https://meta.discourse.org/u/ToddZ)
#### Post date: [2025年十一月12日 17:07 UTC](https://meta.discourse.org/t/maxmind-401-error-have-license-key-cant-download/388284/1 "2025-11-12T17:07:13Z")

</div>

根据[为反向IP查找配置MaxMind](https://meta.discourse.org/t/configure-maxmind-for-reverse-ip-lookups/173941)的说明，我认为我的设置是正确的，但在下载MaxMind数据库时遇到了401错误。

我使用的是标准安装、自托管且版本最新的Discourse。  
我在MaxMind创建了一个账户，并添加了一个新的许可证密钥。

我编辑了app.yml中的ENV部分如下：

```yml
  ## MaxMind地理定位IP地址密钥，用于IP地址查找
  ## 详情请参见 https://meta.discourse.org/t/-/137387/23
  DISCOURSE_MAXMIND_ACCOUNT_ID: [我的账户ID]
  DISCOURSE_MAXMIND_LICENSE_KEY: [我的许可证密钥]

```

然后运行了 `./launcher rebuild app`

在重建过程中，记录了以下“401未授权”错误：

```plaintext
MaxMind数据库GeoLite2-City下载失败。: OpenURI::HTTPError : 401错误
MaxMind数据库GeoLite2-ASN下载失败。: OpenURI::HTTPError : 401错误

```

（当然，没有数据库文件被下载到我的 `/var/www/discourse/vendor/data` 目录中）

根据[这个建议](https://meta.discourse.org/t/ip-location-address-related/258323/5?u=toddz)，我使用了[MaxMind开发者门户](https://dev.maxmind.com/geoip/updating-databases/?lang=en#directly-downloading-databases)中找到的命令——使用完全相同的凭据——直接下载数据库：

```bash
curl -O -J -L -u [我的账户ID]:[我的许可证密钥] \
'https://download.maxmind.com/geoip/databases/GeoLite2-City/download?suffix=tar.gz'

```

该命令运行正常。

那么，我可能遗漏了什么，导致从Discourse连接时出现401错误？

---

_[View the full topic](https://meta.discourse.org/t/maxmind-401-error-have-license-key-cant-download/388284)._
