skip to Main Content

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


  1. 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

    Gunicorn
    

    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

    Login or Signup to reply.
  2. Well, you can use screen to start the application as daemon

    https://linuxhint.com/screen_command_ubuntu/

    Some like that:

    screen
    
    cd <your_dir>/build && git pull && cmake .. && make && ./dbcpp.com --pid=default
    

    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:

    server {
        listen       ...;
        ...
        location / {
            proxy_pass http://127.0.0.1:8080;
        }
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search