1

Regarding the following documentation:

Gunicorn¶ Gunicorn ‘Green Unicorn’ is a WSGI HTTP Server for UNIX. It’s a pre-fork worker model ported from Ruby’s Unicorn project. It supports both eventlet and greenlet. Running a Flask application on this server is quite simple: gunicorn myproject:app Gunicorn provides many command-line options – see gunicorn -h. For example, to run a Flask application with 4 worker processes (-w 4) binding to localhost port 4000 (-b 127.0.0.1:4000): gunicorn -w 4 -b 127.0.0.1:4000 myproject:app

This is all and well, however, the documentation does not say how to configure port 4000 to be accessible from the web.

I want to be able to handshake something like the following,

www.mysite.com:4000

And get back a response. My app works fine on Flask’s development server and Gunicorn locally. I just can’t figure out how to configure it to work on my cloud instance so I can make posts and gets.

reka18
  • 7,440
  • 5
  • 16
  • 37

1 Answers1

3

You are not supposed to make gunicorn available over the web. Instead you are supposed to use it with a reverse proxy, such as nginx.

The gunicorn docs have a full example of configuring nginx to reverse proxy to your gunicorn process.

Daniel Roseman
  • 588,541
  • 66
  • 880
  • 895