Setup for running a custom GPT UI on top of my own API Keys
- Uses Nginx for Reverse proxy
- lets Encrypt for SSL cert generation
- docker-compose for managing all of these stuff together.
The UI for GPT is deployed using - ChatGPT-Next-Web
- Replace
server_name
in the nginx.conf file with the actual server name likechat.example.com
- Set Env variable value for -
OPENAI_API_KEY
- Set Env variable value for -
CODE
- This is the password to access the app - Update the correct path for SSL certificate folder name as it has domain name
sudo dnf install -y augeas-libs
sudo python3 -m venv /opt/certbot/
sudo /opt/certbot/bin/pip install --upgrade pip
sudo /opt/certbot/bin/pip install certbot
sudo ln -s /opt/certbot/bin/certbot /usr/bin/certbot
After the installation is done, run the below command
certbot certonly --standalone -d chat.example.com
- Auto renew script is present at
renew_ssl_and_restart_docker.sh
- Configure it with a cron job. I have set it up to run every month -
0 0 1 * * /home/ec2-user/openai/renew_ssl_and_restart_docker.sh
- The webapp is not accessible on https
If you are deploying on AWS Lightsail or EC2, make sure you allow port 443 You can check for SSL handshake with the below command
openssl s_client -connect chat.example.com:443