简体   繁体   中英

Gunicorn bind both HTTP and HTTPS port

I want to host a python application on Gunicorn server in two different ports. One at HTTP port (8000) and another at HTTPS port(8001). How can we achieve this in Gunicorn?

For http and https, I believe I need to pass two separate gunicorn_config.py files, one which has server certificates and another without any certificate (http).

Is it possible to do so? Or do I have to run two different instance of gunicorn server separatly?

I am using this to run the server:

gunicorn --config gunicorn_config.py application.main:app

According to https://github.com/benoitc/gunicorn/issues/1466 you can do it like this:

gunicorn -k uvicorn.workers.UvicornWorker -w 3 -b 0.0.0.0:30000 -t 360 --reload app:app & gunicorn -k uvicorn.workers.UvicornWorker -w 3 --certfile certfile.txt --keyfile keyfile.txt --ca-certs ca_certs.txt -b 0.0.0.0:8443 -t 360 --reload app:app 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM