Hope to build a web application framework in a flask Ali cloud ECS, classic form is the flask + uWSGI + nginx mode
Server: CentOS 7.3
python Version: 3.8.0
First posted a global map, which clearly shows the link between the various parts and their effect on the shining can better understand the concepts below, be sure to read the article back then stroked a stroke
Source: L & P Essay
Before understanding uWSGI, also we need to know its form is very similar to the other two things WSGI and uwsgi (case-sensitive)
First introduced the big brother among them three - WSGI
WSGI
WSGI, stands for Web Server Gateway Interface, or Python Web Server Gateway Interface, WSGI is not a server, Python module, frame or any software, it is only a norm, as HTTP protocol, as it is defined for the Web server and the Python language simple and universal among Web application (framework) agreement. It can be divided into the Web server and Web applications in two parts.
Web server (Web Server) mentioned above and Web applications (Web Application), common Web application has Flask, Django, etc., Web server plus down will be referred to uWSGI
uWSGI
uWSGI is a Web server (role like Apache), which implements the WSGI protocol, you can receive a request from a client, the response is forwarded to the program, but after that we want to configure the two brothers uWSGI
uwsgi
The youngest of three brothers (no capital letters) uwsgi, and the boss just as a protocol, it is natural uWSGI server protocols supported
Official website: " The Protocol Used by Native The uWSGI Server ", which uses four bytes to represent any type of data transmission
There are three two agreements ( WSGI , uwsgi ), only need to understand their differences and connections can, we really need to be configured on only uWSGI that the Web server.
In fact, there are uWSGI Web server to receive and forward client requests, plus Flask application framework to process the request, we can already achieve functionality of the website, then why the need to use Nginx mention it?
Why Nginx?
When a small site traffic, of course, can be directly used uWSGI + Flask for processing, but once the volume of traffic, reduce server processing speed uWSGI, client requests will be carried out for a long time to wait, in order to solve this problem, we could use more several Web servers, both to process the request, but this has led to a problem, what should a request which server responds with it? We need a network management, network management and Nginx is this
Source: CHENYAoo
Nginx
Nginx as efficient Web server, may be used as a reverse proxy server, which has three common features: HTTP proxy, load balancing, Web caching, detailed functions and implementation can refer to a novice course , the configuration process may appreciate its how to achieve load balancing, this is mainly allowed to serve as a reverse proxy server , it is easy to understand the pros and cons for the agency, by this picture
Source: rookie Tutorial
It required a major role and function of each module introduced here, our next record housekeeper and two brothers - Nginx and uWSGI detailed installation and configuration
Reminder: To go back to see the first figure ah!
In addition to the paper listed refer to the article, the main reference articles are:
Medium coke no ice: https://www.cnblogs.com/fengchong/p/10230266.html
Thank you, above you!