diff --git a/backend/README.md b/backend/README.md index 100224a..1d2b9ab 100644 --- a/backend/README.md +++ b/backend/README.md @@ -23,6 +23,36 @@ pip install -r backend/requirements-backend.txt uvicorn backend.main:app --host 0.0.0.0 --port 8000 ``` +### Deploy with your domain name +You can deploy the server with your domain name by setting up a reverse proxy with Nginx. + +1. Install Nginx if you don't already have it. +- Linux : https://nginx.org/en/docs/install.html +- Windows : https://nginx.org/en/docs/windows.html + +2. Edit [`nginx.conf`](https://github.com/jhj0517/Whisper-WebUI/blob/master/backend/nginx/nginx.conf) for your domain name. +https://github.com/jhj0517/Whisper-WebUI/blob/895cafe400944396ad8be5b1cc793b54fecc8bbe/backend/nginx/nginx.conf#L12 + +3. Add an A type record of your public IPv4 address in your domain provider. (you can get it by searching "What is my IP" in Google) + +4. Open a terminal and go to the location of [`nginx.conf`](https://github.com/jhj0517/Whisper-WebUI/blob/master/backend/nginx/nginx.conf), then start the nginx server, so that you can manage nginx-related logs there. +```shell +cd backend/nginx +nginx -c "/path/to/Whisper-WebUI/backend/nginx/nginx.conf" +``` + +5. Open another terminal in the root project location `/Whisper-WebUI`, and deploy the app with `uvicorn` or whatever. Now the app will be available at your domain. +```shell +uvicorn backend.main:app --host 0.0.0.0 --port 8000 +``` + +6. When you turn off nginx, you can use `nginx -s stop`. +```shell +cd backend/nginx +nginx -s stop -c "/path/to/Whisper-WebUI/backend/nginx/nginx.conf" +``` + + ## Configuration You can set some server configurations in [config.yaml](https://github.com/jhj0517/Whisper-WebUI/blob/master/backend/configs/config.yaml).
For example, initial model size for Whisper or the cleanup frequency and TTL for cached files. diff --git a/backend/nginx/logs/logs_are_generated_here b/backend/nginx/logs/logs_are_generated_here new file mode 100644 index 0000000..e69de29 diff --git a/backend/nginx/nginx.conf b/backend/nginx/nginx.conf new file mode 100644 index 0000000..52aadf8 --- /dev/null +++ b/backend/nginx/nginx.conf @@ -0,0 +1,23 @@ +worker_processes 1; + +events { + worker_connections 1024; +} + +http { + server { + listen 80; + client_max_body_size 4G; + + server_name your-own-domain-name.com; + + location / { + proxy_pass http://127.0.0.1:8000; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } + } +} + diff --git a/backend/nginx/temp/temps_are_generated_here b/backend/nginx/temp/temps_are_generated_here new file mode 100644 index 0000000..e69de29