after installing pip install gunicorn (in the virtual environment, it can be omitted.
I used uwsgi, for a long time, but it didn't work all the time. After using gunicorn, I found that compared with uwsgi, it was not too easy.
then modify the configuration file default of nginx (modify the files managed by your project nginx)
server {
listen 80;
server_name 120.79.2.46;
location / {
proxy_pass http://127.0.0.1:8888;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
then under the project directory, gunicorn-w 4-b 0.0.0.0 supervisor 8888 manage:app
if you want to facilitate management, it is recommended to use supervisor to manage the project
< H2 > I deploy the flask application with nginx + gunicorn. < H2 > it is found that both nginx and gunicorn and flask work well, but they do not work together. mainly because nginx listens to the public network port 80 is normal, but cannot reverse ...
I bought a server, and I encountered some problems when deploying flask program for the first time, as follows Google found that you can directly use gunicorn3 to support python3 . After the server is installed, it can be started using gunicorn3...