ChatGPT-Proxy
...About 1 min
Build ChatGPT Reverse Proxy
- Due to the free proxy of the ChatGPT-Web project being down, we choose this project to address the proxy issue.
Build Steps
1. Install Docker and Docker-compose
- Install Docker
# Update and install essential software
apt-get update && apt-get install -y wget nano
# Install Docker
curl -sSL https://get.docker.com/ | sh
# Start Docker on boot
systemctl start docker
systemctl enable docker
- Install Docker-compose
sudo curl -L "https://github.com/docker/compose/releases/download/v2.22.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
go-chatgpt-api
2. Install- Create a directory
mkdir -p /data/docker_data/go-chatgpt-api
cd /data/docker_data/go-chatgpt-api
- Create a docker-compose.yml file
nano docker-compose.yml
- Enter the following content in the file, then save with Ctrl+X and exit with Y
version: "3"
services:
go-chatgpt-api:
container_name: go-chatgpt-api
image: linweiyuan/go-chatgpt-api
ports:
- 8080:8080 # Container port mapped to host port 8080; adjust host port as needed
environment:
- GIN_MODE=release
- CHATGPT_PROXY_SERVER=http://chatgpt-proxy-server:9515
#- NETWORK_PROXY_SERVER=http://host:port # NETWORK_PROXY_SERVER: Shadowsocks proxy address, e.g., http://10.0.5.10:7890
#- NETWORK_PROXY_SERVER=socks5://host:port # NETWORK_PROXY_SERVER: Shadowsocks proxy address
depends_on:
- chatgpt-proxy-server
restart: unless-stopped
chatgpt-proxy-server:
container_name: chatgpt-proxy-server
image: linweiyuan/chatgpt-proxy-server
restart: unless-stopped
- After creating, run
docker-compose up -d
- Check running containers; ensure the container status is UP
docker ps
- Check if the mapped listening port on the host is active
ss -tnlp|grep 8080
3. Use Self-built Reverse Proxy
- Use the access token mode and access with our self-built proxy address; the access address for the self-built IP is http://ip:8080/conversation; if you don't want to expose the ip, you can use nginx to reverse proxy ip + port, https://example.com/conversation.
# Reverse proxy, optional
API_REVERSE_PROXY: https://example.com/conversation
- Now, access chatgpt-web to see if it works properly. Make sure chatgpt-proxy-server is running correctly, and go-chatgpt-api needs some time to initialize.
# Check container logs for normal operation
docker logs -f chatgpt-proxy-server
docker logs -f go-chatgpt-api
Completed
Tutorial Source:
Powered by Waline v2.15.8