Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

fnep/example_fastapi_behind_apache_using_cgi

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

example how to run FastApi behind Apache without reverse proxy using mod_wsgi

Topics

Resources

Stars

Watchers

Forks

Morty Proxy This is a proxified and sanitized view of the page, visit original site.