Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting Gunicorn to run on port 80

Tags:

I built an API with flask. My app does not have any static assets hence there's no reason for me to use nginx.

I wish to run gunicorn on port 80.

I have a "deploy script":

mkdir .log 2> /dev/null DEBUG=0 gunicorn -b 0.0.0.0:80 backend:app --access-logfile .log/access.log --error-logfile .log/general.log 

I wish to run gunicorn on port 80 with authbind. I followed this guide here.

Note that I am able to run authbind python -m SimpleHTTPServer 80

When I try to run authbind ./deployment.run 80,

I am seeing the following error:

2013-04-25 15:32:55 [24006] [ERROR] Can't connect to ('0.0.0.0', 80) 2013-04-25 15:33:08 [24018] [INFO] Starting gunicorn 0.17.4 2013-04-25 15:33:08 [24018] [ERROR] Retrying in 1 second. 2013-04-25 15:33:09 [24018] [ERROR] Retrying in 1 second. 2013-04-25 15:33:10 [24018] [ERROR] Retrying in 1 second. 2013-04-25 15:33:11 [24018] [ERROR] Retrying in 1 second. 2013-04-25 15:33:12 [24018] [ERROR] Retrying in 1 second. 

Any ideas why I am unable to bind gunicorn to port 80?

Any recommendations?

like image 874
disappearedng Avatar asked Apr 25 '13 22:04

disappearedng


People also ask

How do I run Gunicorn on specific port?

Configure Gunicorn The Gunicorn process will start and bind to all host IP addresses on port 8081. Use control + z to terminate Gunicorn process. Note: The default (host) port can be configured here to use any other open port on which you prefer to expose the Transform. Note: In this case 'python3' must be specified.

How do I enable Gunicorn?

Running sudo -u www-data curl --unix-socket /run/gunicorn. sock http , our Gunicorn service will be automatically started and you should see some HTML from your server in the terminal. systemd employs cgroups to track the processes of a service, so it doesn't need pid files.

Do I need Nginx in front of Gunicorn?

It is recommended in Gunicorn docs to run it behind a proxy server. Technically, you don't really need Nginx. BUT it's the Internet: your server will receive plenty of malformed HTTP requests which are made by bots and vulnerability scanner scripts.

How do I run Gunicorn on Linux?

You can run Gunicorn by using commands or integrate with popular frameworks like Django, Pyramid, or TurboGears. For deploying Gunicorn in production see Deploying Gunicorn.


1 Answers

If you are on a unix-like environment, ports < 1024 (like 80) will require superuser privileges.

like image 134
Uku Loskit Avatar answered Sep 29 '22 13:09

Uku Loskit