Answer the question
In order to leave comments, you need to log in
How to bind uvicorn to a domain on the server?
Hello, how to install yuvicorn on your domain? I run it on a web server from reg ru, but it runs on a local host reg ru with a domain in the form of an IP address, how can I make it work on my domain?
Answer the question
In order to leave comments, you need to log in
Set up nginx to proxy requests to uvicorn, specify the domain there and at the same time you can attach a certificate from Let's Encrypt after you master the initial setup
http {
server {
listen 80;
client_max_body_size 4G;
server_name example.com;
location / {
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_redirect off;
proxy_buffering off;
proxy_pass http://uvicorn;
}
location /static {
# path for static files
root /path/to/app/static;
}
}
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
upstream uvicorn {
server 127.0.0.1:8000;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question