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 proxy to the gunicorn of port 5000
gunicorn is as follows
gunicorn wsgi-- bind 0.0.0.0 code 5000
I found that gunicorn + flask successfully runs on port 5000
and can successfully access the website in the server through port 5000 in the browser
nginx are as follows
/ etc/nginx/sites-enabled/web
the contents of the web file are as follows
server {
listen 80;
location / {
proxy_pass http://localhost:5000;
}
}
I successfully restarted nginx several times through service nginx restart
.
use nginx-t
to check whether the configuration is successful. The result is as follows:
nginx: the configuration file / etc/nginx/nginx.conf syntax is ok
nginx: configuration file / etc/nginx/nginx.conf test is successful
I use the browser to access ip without adding port (default port 80). The content of the web page is welcome to nginx
now I don"t know how to solve the problem