From f582312e203eed807a28ad03e43673400bc3a239 Mon Sep 17 00:00:00 2001 From: Crony Akatsuki Date: Sun, 26 Mar 2023 10:09:14 +0200 Subject: [PATCH] Update README with nginx proxy setup and uvicorn command. --- README.md | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 42797ed..1ec4e3c 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ source venv/bin/activate pip install -r requirements.txt # Run the project -uvicorn main:app --host 127.0.0.1 --port 8000 --proxy-headers +uvicorn main:app --host 127.0.0.1 --port 8000 --proxy-headers --forwarded-allow-ips='*' ``` ### Docker @@ -34,4 +34,27 @@ To run the docker container check the container id with `docker images` command. sudo docker run -p 8000:8000 -v ./upload:/usr/src/app/upload CONTAINER_ID ``` -The sample command will need a upload directory to where you run it from so you can replace ./upload with a different path to save uploaded stuff. +The sample command will need a upload directory to where you run it from so you can replace `./upload` with a different path to save uploaded stuff. + +### Nginx Proxy setup + +This is an example nginx proxy config for http + +```nginx +server { + + listen 80; + listen [::]:80; + + server_name upfast.example.com ; + + location / { + proxy_pass http://127.0.0.1:8000; + proxy_set_header Host $host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_redirect off; + proxy_buffering off; + } +} +```