The Nginx gateway serves the following purposes:
On Debian-based distributions (e.g., Ubuntu):
sudo apt update
sudo apt install nginx
On Red Hat-based distributions (e.g., CentOS, Fedora):
sudo yum install epel-release
sudo yum install nginx
Copy nginx.conf
to /etc/nginx/nginx.conf
(need sudo permission).
Replace the port number 7860 in server localhost:7860
with the port where you deploy the Gradio web server.
Modify upstream websocket
to configure Gradio servers behind the gateway.
Lastly, update Nginx.
Make sure you obtain the HTTPS certificate and the private key used to generate the certificate.
Fill the addresses to your certificate and private key in the [PATH_TO_SSL_CERT]
and [PATH_TO_PRIVATE_KEY]
fields.
If you have your own domain url to serve the chatbot, replace the chat.lmsys.org url with your own domain url.
Every time when /etc/nginx/nginx.conf
is modified, you need to update the Nginx service:
sudo nginx -t # check `/etc/nginx/nginx.conf`
sudo systemctl reload nginx # restart Nginx service to load the new config
sudo systemctl status nginx # check the status of the Nginx service. It should be active (running).