วันจันทร์ที่ 8 กรกฎาคม พ.ศ. 2567

Gunicorn (Web Server Gateway Interface: WSGI)

The standard web servers such as Apache, and NGINX (pronounced engine-x) don’t know how to communicate with your Python applications. Web servers receive the request from a client(Web browser) and return a response. WSGI provides that bridge of your need to communicate between your Web Server and Web Application. Through multi-threading, WSGI also handles scaling for web servers to be able to handle thousands of requests at the same time.

Bypassing NGINX web server to directly contact Gunicorn at port 8000:

 https://medium.com/@serdarilarslan/what-is-gunicorn-5e674fff131b

Not bypassing NGINX to contact Gunicorn at standard HTTP port (install Python & Gunicorn in app tier and Nginx in web tier to fwd http requests to app tier):

https://www.digitalocean.com/community/tutorials/how-to-serve-flask-applications-with-gunicorn-and-nginx-on-ubuntu-18-04

Unlike PHP that can be directly executed by Apache, PHP doesn't need a kind of WSGI.