Many projects tend to use non-embedded web servers in production. Most popular examples are that of Spring(Java), PHP and Flask(Python). It is recommended in Flask’s website that Flask not be used with its internal web server at production. Same goes for Spring.
It seems to me that Drogon has an internal web server. Is it supposed to be used in production? If not, how do I use it with a web server like Apache or Nginx?
2
Answers
It’s not that you can’t use the Flask Internal web server.
It’s that you really shouldn’t.
For Flask specifically, I would recommend using
You can use NGINX as your reverse proxy here and Gunicorn as your web server.
There is a guide on how to do just that here:
https://www.digitalocean.com/community/tutorials/how-to-serve-flask-applications-with-gunicorn-and-nginx-on-ubuntu-18-04
Internal web-servers are almost never supposed to be used in production
Well, you can use screen to start the application as daemon
https://linuxhint.com/screen_command_ubuntu/
Some like that:
So now you have your app started and then you may just use nginx as proxy if you want
https://gist.github.com/soheilhy/8b94347ff8336d971ad0
Like this: