Deploying Crax is similar to deploying any other ASGI application. If you have worked with any other ASGI framework you won’t see anything new in this chapter. Let’s take a simple example deploying Crax behind NGINX WebServer.

Take a look at the Uvicorn Deployment section. We’re going to do the same. Write your nginx config file.

vi /etc/nginx/sites-available/crax
http {
    server {
        listen 80;
        client_max_body_size 4G;


        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_redirect off;
            proxy_buffering off;
            proxy_pass http://uvicorn;

        location /static {
            # path for static files
            root /path/to/app/static;

    upstream uvicorn {
        server unix:/tmp/uvicorn.sock;

Link your config to the enabled NGINX sites

cd /etc/nginx/sites-enabled/
ln -s ../sites-available/crax .
systemctl restart nginx

Install Gunicorn in your virtual environment.

pip install gunicorn

Write systemd service.

vi /usr/lib/systemd/system/crax.service
Description=Crax launcher

ExecStart=/path/to/gunicorn -w 4 -k uvicorn.workers.UvicornWorker app:app

systemctl enable crax
systemctl start crax

Of course, instead of systemd, you can use your favorite process manager. It is perfectly described in the documentation for Uvicorn .