Wood Chen

Build a ChatGPT-Style Chat Website with Docker on a Synology NAS

0 comments240 views281 words

This post was translated from Chinese by AI. If anything reads oddly, the Chinese original is authoritative. 中文原文

Result


1. Fetch the source code from https://github.com/Chanzhaoyu/chatgpt-web

2. Update the information and build the image

  1. Edit the information shown in the bottom-left corner in this file

    /src/store/modules/user/helper.ts
    
  2. In the service folder, copy the contents of .env.example, create a new .env file, and paste the contents into it. Modifying the contents is optional.

  3. Right-click Dockerfile and select Build image

  4. push it to your own Docker registry, then pull the image

3. Deploy on a Synology NAS

1. Select the downloaded image and click Launch

2. Click 高级设置 and set the network to use docker host networking

3. Configure the environment

  1. Add OPENAI_API_KEY and set it to your own key
  2. Add OPENAI_API_BASE_URL and set it to your API proxy URL
  3. Add AUTH_SECRET_KEY and set it to a password of your choice
  4. If you use a socks5 proxy, configure SOCKS_PROXY_HOST 和 SOCKS_PROXY_PORT
  5. Using ACCESS_TOKEN is not recommended, as OpenAI has started banning accounts

Official documentation

API 可用:
    - OPENAI_API_KEY 和 OPENAI_ACCESS_TOKEN 二选一
    - OPENAI_API_MODEL 设置模型,可选,默认:gpt-3.5-turbo
    - OPENAI_API_BASE_URL 设置接口地址,可选,默认:https://api.openai.com
    
ACCESS_TOKEN 可用:
    - OPENAI_ACCESS_TOKEN 和 OPENAI_API_KEY 二选一,同时存在时,OPENAI_API_KEY 优先
    - API_REVERSE_PROXY 设置反向代理,可选,默认:https://bypass.duti.tech/api/conversation,社区(注意:只有这两个是推荐,其他第三方来源,请自行甄别)
    
通用:
    - AUTH_SECRET_KEY 访问权限密钥,可选
    - MAX_REQUEST_PER_HOUR 每小时最大请求次数,可选,默认无限
    - TIMEOUT_MS 超时,单位毫秒,可选
    - SOCKS_PROXY_HOST 和 SOCKS_PROXY_PORT 一起时生效,可选
    - SOCKS_PROXY_PORT 和 SOCKS_PROXY_HOST 一起时生效,可选
    - HTTPS_PROXY 支持 http,https, socks5,可选
    - ALL_PROXY 支持 http,https, socks5,可选

Start the container configured in step 3 and set up a reverse proxy on Synology

If you haven't changed the port in Dockerfile, the default is 3002. Since we configured the network to use docker host, you need to add a reverse proxy for external access.

  1. Open Control Panel - Synology Portal - Reverse Proxy Server
  2. Add a configuration with your public-facing port and domain as the source, and localhost:3002 as the destination
  3. Click OK, then use https://域名:13002 from outside your local network to access your self-hosted site. It's quite fast.

Thanks to the developer for making this open source

Last updated 2025-06-25

Related posts

Comments 0