Have a day more, finally straightened out the deployment principle of UWSGI, the following summarizes some of the pits encountered, hoping to give the reader less detours.
In short, UWSGI is a Web server, Nginx reverse proxy actually with these servers can say no relationship, you provide dynamic content of the server can be apache/nginx/tomcat, of course, can also be uwsgi, The agency relationship between them is actually communicated through the TCP/IP protocol. Of course Uwsgi has a special place relative to other servers, except that it can provide a unique UWSGI protocol for communication. In other words, the communication protocol between Nginx and Uwsgi can have two options: http and Uwsgi.
Having understood this, the entire deployment process is left with relatively independent steps:
1, first to have a flask application
2. Then deploy the Flask application with UWSGI
3. Start and deploy Nginx server
4, configure the Nginx reverse proxy, point to the IP and port of Uwsgi, or point to the sock file
Cond...
Deployment of Uwsgi+nginx+flask under Linux