Skip to content

Latest commit

 

History

History
20 lines (13 loc) · 1.07 KB

File metadata and controls

20 lines (13 loc) · 1.07 KB

Run FastApi behind Apache with cgi

This is an example repository, to show how to run FastAPI behind Apache HTTP Server without reverse proxy, but using mod_cgid with a venv and the WSGIMiddleware instead.

⚠️ This is definitely not recommended (for example because it's super slow), but in some cases, it is not an option or not wanted to run a separate server process (like using Uvicorn) or to at least to use wsgi. I just found it challenging to see if it works.

This example is in a Docker container, so you can run it with:

> docker compose up

and check the result with:

> curl http://localhost:8080/api/
{"message":"Hello World 👋"}

… but it is more meant to be a documentation and one can install the same everywhere.