鸽子衔枝之年

鸽子衔枝之年

Build ChatGPT servers quickly using Vercel

Before you start, you need to understand these concepts#

  • Domain names purchased from domain name providers within mainland China require real-name authentication to enable DNS resolution. However, domain names purchased from foreign domain name providers do not require this.
  • Websites that point to cloud servers within mainland China must be filed for record before they can be accessed normally. However, any domain name that points to a foreign server is not subject to this rule. You can take advantage of this to bypass the restriction.
  • Vercel is a platform that allows you to deploy modern web applications quickly without the need for a cloud server.
  • vercel.app itself is a blocked website, but its server IP is not blocked. You can take advantage of this to directly point your domain name to the Vercel server and access the services provided by Vercel.
  • This article uses Yidadaa/ChatGPT-Next-Web to build the ChatGPT web service.

Prerequisites#

  • OpenAI API Key
  • A domain name
  • Magic (required to access Vercel)

Detailed Steps#

  1. Fork the Yidadaa/chatgpt-vercel project to your GitHub.

  2. Create a new project in Vercel and select the project you just forked. Click the Import button.
    Screenshot 2023-04-05 20.38.53

  3. Add environment variables in the Environment Variables section, then click the Deploy button.

    For personal use, adding OPENAI_API_KEY and CODE is sufficient.

    CODE can have multiple passwords, separated by commas. The 123456,789012 in the image represents that 123456 and 789012 are both passwords.

    Screenshot 2023-04-05 20.42.50If you want to learn more about the environment variables in this project, please refer to the official environment variable documentation of ChatGPT-Next-Web.

    Please note: The API Key shown in the image is not complete and has been processed, so it cannot be used directly.

  4. Now, your project has been successfully deployed. Try accessing it and see if it works.

    Screenshot 2023-04-05 20.47.16

  5. Remember to fill in your authorization code in Settings -> Authorization Code with the passwords you set in the CODE environment variable, otherwise it will not work.

    Screenshot 2023-04-05 20.49.08

    Here, I ask ChatGPT to recommend gradient colors for me in a specific format (HTML code). Rendering HTML code with Typora can greatly improve the readability and intuitiveness of the content.

    IMG_3872

    Screenshot 2023-04-05 21.15.45

  6. Bind your domain name. Click Settings -> Domains, enter the domain name you want to bind, and then click the Add button.

    Here, we use test.nekoko.top as an example.

    Screenshot 2023-03-27 12.04.57

  7. Add Vercel's CNAME or A record to your domain name's DNS resolution (either one is fine).

    Here, we use Cloudflare as an example. Open the website dash.cloudflare.com and add DNS records.

    • DNS -> Records -> Add Record. Add a CNAME record as follows and save it.

      cname-china.vercel-dns.com
      

      Screenshot 2023-03-27 12.11.28

      Screenshot 2023-03-27 12.19.49

  8. Open your bound domain name in a browser. Here, we use test.nekoko.top as an example.

    Please note that if the browser address bar shows Not Secure, wait a few minutes before accessing it again because Vercel is generating an SSL certificate and the browser cannot use HTTPS connection at this time.

    Screenshot 2023-04-05 21.24.37

    In the Vercel project's Settings -> Domains, the successfully bound domain name should be similar to the image below.

    Screenshot 2023-03-27 12.27.35

  9. When you cannot ensure that your visitors will use your service properly and reasonably, please be careful not to share your website casually unless you trust them enough. Any suspicious activity may result in your domain name being blocked.

References#

[1] Vercel 应用绑定自己的域名 | TANGLY’s BLOG (tangly1024.com)

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.