# New-api for Nodeloc 现已上线Docker版本 附食用指北

**URL:** <https://2hkj2s.loc.rr.kg/t/topic/59907>\
**Category:** AI\
**Tags:** AI\
**Created:** [2025 年9 月 13 日 11:02 UTC](https://2hkj2s.loc.rr.kg/t/topic/59907 "2025-09-13T11:02:03Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

作者： ![James](https://2hkj2s.loc.rr.kg/user_avatar/2hkj2s.loc.rr.kg/james/32/1745_2.png) [@James](https://2hkj2s.loc.rr.kg/u/James)\
发布日期： [2025 年9 月 13 日 11:02 UTC](https://2hkj2s.loc.rr.kg/t/topic/59907/1 "2025-09-13T11:02:03Z")

</div>

演示 [https://ai.nodeloc.com](https://ai.nodeloc.com) (不能用，因为没Key

安装方法，首先安装 Docker（如果服务器有Docker环境可跳过）

```auto
apt install docker
apt install docker.io -y

```

* * *

一句话命令安装

```auto
docker pull nodeloc/new-api:latest
docker compose up -d

```

* * *

创建一个目录，比如 `nlapi`

```auto
mkdir nlapi 
cd nlapi
nano docker-compose.yml

```

将下面的内容粘贴进去然后 `Ctrl+X` 保存退出

```auto
version: '3.4'

services:
  new-api:
    image: nodeloc/new-api:latest
    container_name: new-api
    restart: always
    command: --log-dir /app/logs
    ports:
      - "3000:3000"
    volumes:
      - ./data:/data
      - ./logs:/app/logs
    environment:
      - SQL_DSN=root:123456@tcp(mysql:3306)/new-api # Point to the mysql service
      - REDIS_CONN_STRING=redis://redis
      - TZ=Asia/Shanghai
      - ERROR_LOG_ENABLED=true # 是否启用错误日志记录
    # - STREAMING_TIMEOUT=300 # 流模式无响应超时时间，单位秒，默认120秒，如果出现空补全可以尝试改为更大值
    # - SESSION_SECRET=random_string # 多机部署时设置，必须修改这个随机字符串！！！！！！！
    # - NODE_TYPE=slave # Uncomment for slave node in multi-node deployment
    # - SYNC_FREQUENCY=60 # Uncomment if regular database syncing is needed
    # - FRONTEND_BASE_URL=https://openai.justsong.cn # Uncomment for multi-node deployment with front-end URL

    depends_on:
      - redis
      - mysql
    healthcheck:
      test: ["CMD-SHELL", "wget -q -O - http://localhost:3000/api/status | grep -o '\"success\":\\s*true' | awk -F: '{print $$2}'"]
      interval: 30s
      timeout: 10s
      retries: 3

  redis:
    image: redis:latest
    container_name: redis
    restart: always

  mysql:
    image: mysql:8.2
    container_name: mysql
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: 123456 # Ensure this matches the password in SQL_DSN
      MYSQL_DATABASE: new-api
    volumes:
      - mysql_data:/var/lib/mysql
    # ports:
    # - "3306:3306" # If you want to access MySQL from outside Docker, uncomment

volumes:
  mysql_data:

```

然后使用命令拉起容器即可

```auto
docker-compose up -d

```

如果想走其它端口可以直接改 `docker-compose.yml` 的映射端口，但是建议使用`nginx` 反代。

---

<div class="post-metadata">

作者： ![kvsn4p9mtz](https://2hkj2s.loc.rr.kg/user_avatar/2hkj2s.loc.rr.kg/kvsn4p9mtz/32/29_2.png) [@kvsn4p9mtz](https://2hkj2s.loc.rr.kg/u/kvsn4p9mtz)\
发布日期： [2025 年9 月 13 日 14:03 UTC](https://2hkj2s.loc.rr.kg/t/topic/59907/2 "2025-09-13T14:03:57Z")

</div>

很好的教程，感谢分享

---

<div class="post-metadata">

作者： ![tianzi](https://2hkj2s.loc.rr.kg/user_avatar/2hkj2s.loc.rr.kg/tianzi/32/14619_2.png) [@tianzi](https://2hkj2s.loc.rr.kg/u/tianzi)\
发布日期： [2025 年9 月 13 日 14:17 UTC](https://2hkj2s.loc.rr.kg/t/topic/59907/3 "2025-09-13T14:17:12Z")

</div>

哇哦！又有好东西

---

<div class="post-metadata">

作者： ![heiyu](https://2hkj2s.loc.rr.kg/user_avatar/2hkj2s.loc.rr.kg/heiyu/32/1771_2.png) [@heiyu](https://2hkj2s.loc.rr.kg/u/heiyu)\
发布日期： [2025 年9 月 13 日 14:19 UTC](https://2hkj2s.loc.rr.kg/t/topic/59907/4 "2025-09-13T14:19:28Z")

</div>

漂亮 我来搞一个

---

<div class="post-metadata">

作者： ![local](https://2hkj2s.loc.rr.kg/letter_avatar_proxy/v4/letter/l/b5a626/32.png) [@local](https://2hkj2s.loc.rr.kg/u/local)\
发布日期： [2025 年9 月 13 日 14:51 UTC](https://2hkj2s.loc.rr.kg/t/topic/59907/5 "2025-09-13T14:51:32Z")

</div>

Nodeloc也要有自己的AI站了吗 :xhj005:  
期待一下 :xhj16:

---

<div class="post-metadata">

作者： ![1haoren88](https://2hkj2s.loc.rr.kg/user_avatar/2hkj2s.loc.rr.kg/1haoren88/32/402_2.png) [@1haoren88](https://2hkj2s.loc.rr.kg/u/1haoren88)\
发布日期： [2025 年9 月 13 日 15:03 UTC](https://2hkj2s.loc.rr.kg/t/topic/59907/6 "2025-09-13T15:03:12Z")

</div>

纯支持

---

<div class="post-metadata">

作者： ![happyevryday](https://2hkj2s.loc.rr.kg/user_avatar/2hkj2s.loc.rr.kg/happyevryday/32/2055_2.png) [@happyevryday](https://2hkj2s.loc.rr.kg/u/happyevryday)\
发布日期： [2025 年9 月 13 日 15:34 UTC](https://2hkj2s.loc.rr.kg/t/topic/59907/7 "2025-09-13T15:34:49Z")

</div>

与时俱进，开拓创新，不错不错。👍

---

<div class="post-metadata">

作者： ![WebURL](https://2hkj2s.loc.rr.kg/user_avatar/2hkj2s.loc.rr.kg/weburl/32/643_2.png) [@WebURL](https://2hkj2s.loc.rr.kg/u/WebURL)\
发布日期： [2025 年9 月 14 日 00:43 UTC](https://2hkj2s.loc.rr.kg/t/topic/59907/8 "2025-09-14T00:43:39Z")

</div>

感謝分享~

---

<div class="post-metadata">

作者： ![GradyShah](https://2hkj2s.loc.rr.kg/user_avatar/2hkj2s.loc.rr.kg/gradyshah/32/16595_2.png) [@GradyShah](https://2hkj2s.loc.rr.kg/u/GradyShah)\
发布日期： [2025 年9 月 14 日 09:55 UTC](https://2hkj2s.loc.rr.kg/t/topic/59907/9 "2025-09-14T09:55:12Z")

</div>

谢谢佬.

---

<div class="post-metadata">

作者： ![Hoog2025](https://2hkj2s.loc.rr.kg/user_avatar/2hkj2s.loc.rr.kg/hoog2025/32/33209_2.png) [@Hoog2025](https://2hkj2s.loc.rr.kg/u/Hoog2025)\
发布日期： [2025 年9 月 14 日 10:12 UTC](https://2hkj2s.loc.rr.kg/t/topic/59907/10 "2025-09-14T10:12:21Z")

</div>

感謝分享~

---

<div class="post-metadata">

作者： ![zero1](https://2hkj2s.loc.rr.kg/letter_avatar_proxy/v4/letter/z/a183cd/32.png) [@zero1](https://2hkj2s.loc.rr.kg/u/zero1)\
发布日期： [2025 年9 月 14 日 16:30 UTC](https://2hkj2s.loc.rr.kg/t/topic/59907/11 "2025-09-14T16:30:21Z")

</div>

看看干什么用的

---

<div class="post-metadata">

作者： ![AlteremLiu](https://2hkj2s.loc.rr.kg/user_avatar/2hkj2s.loc.rr.kg/alteremliu/32/16880_2.png) [@AlteremLiu](https://2hkj2s.loc.rr.kg/u/AlteremLiu)\
发布日期： [2025 年9 月 14 日 16:38 UTC](https://2hkj2s.loc.rr.kg/t/topic/59907/12 "2025-09-14T16:38:36Z")

</div>

> [@James](#):
>
> `GNU nano 8.4 `

多了

---

<div class="post-metadata">

作者： ![creminjess](https://2hkj2s.loc.rr.kg/letter_avatar_proxy/v4/letter/c/e9a140/32.png) [@creminjess](https://2hkj2s.loc.rr.kg/u/creminjess)\
发布日期： [2025 年10 月 11 日 10:44 UTC](https://2hkj2s.loc.rr.kg/t/topic/59907/13 "2025-10-11T10:44:45Z")

</div>

这些干货，真是宝藏！

---

<div class="post-metadata">

作者： ![Speeeed](https://2hkj2s.loc.rr.kg/user_avatar/2hkj2s.loc.rr.kg/speeeed/32/24228_2.png) [@Speeeed](https://2hkj2s.loc.rr.kg/u/Speeeed)\
发布日期： [2025 年10 月 11 日 11:46 UTC](https://2hkj2s.loc.rr.kg/t/topic/59907/14 "2025-10-11T11:46:53Z")

</div>

纯支持！

---

<div class="post-metadata">

作者： ![wuwuwu](https://2hkj2s.loc.rr.kg/letter_avatar_proxy/v4/letter/w/50afbb/32.png) [@wuwuwu](https://2hkj2s.loc.rr.kg/u/wuwuwu)\
发布日期： [2026 年1 月 20 日 08:48 UTC](https://2hkj2s.loc.rr.kg/t/topic/59907/15 "2026-01-20T08:48:43Z")

</div>

期待公益ai

---

<div class="post-metadata">

作者： ![James](https://2hkj2s.loc.rr.kg/user_avatar/2hkj2s.loc.rr.kg/james/32/1745_2.png) [@James](https://2hkj2s.loc.rr.kg/u/James)\
发布日期： [2026 年1 月 20 日 13:14 UTC](https://2hkj2s.loc.rr.kg/t/topic/59907/16 "2026-01-20T13:14:00Z")

</div>

```auto
docker pull nodeloc/new-api:latest
docker compose up -d

```

最新两条命令安装，非常简单，集成NodeLoc登录。

---

<div class="post-metadata">

作者： ![sdcfre](https://2hkj2s.loc.rr.kg/user_avatar/2hkj2s.loc.rr.kg/sdcfre/32/30620_2.png) [@sdcfre](https://2hkj2s.loc.rr.kg/u/sdcfre)\
发布日期： [2026 年1 月 20 日 13:19 UTC](https://2hkj2s.loc.rr.kg/t/topic/59907/17 "2026-01-20T13:19:09Z")

</div>

感谢分享
