Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gunicorn not starting on port 80 but starting on port 8000

I am using gunicorn and trying to write the upstart script. I am testing the command in the command line and for port 80 it just gets errors

command

gunicorn --bind 0.0.0.0:80 --workers 3 myapp.wsgi:application

log

[2016-10-19 02:36:51 +0000] [12752] [INFO] Starting gunicorn 19.6.0
[2016-10-19 02:36:51 +0000] [12752] [ERROR] Retrying in 1 second.
[2016-10-19 02:36:52 +0000] [12752] [ERROR] Retrying in 1 second.
[2016-10-19 02:36:53 +0000] [12752] [ERROR] Retrying in 1 second.
[2016-10-19 02:36:54 +0000] [12752] [ERROR] Retrying in 1 second.
[2016-10-19 02:36:55 +0000] [12752] [ERROR] Retrying in 1 second.
[2016-10-19 02:36:56 +0000] [12752] [ERROR] Can't connect to ('0.0.0.0', 80)

any ideas why this is not working? Sometimes it works for port 8000.

like image 687
xazb Avatar asked Oct 29 '22 18:10

xazb


2 Answers

You have to use 'sudo' command for this.

sudo gunicorn --bind 0.0.0.0:80 --workers 3 myapp.wsgi:application

Port 80 requires superuser privilege.

like image 172
RoboMex Avatar answered Nov 15 '22 06:11

RoboMex


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

From the question: https://stackoverflow.com/a/16225928/6823310

Originally answered by:

https://stackoverflow.com/users/358328/uku-loskit

This is why port 8000 works and 80 do not.

Try running the command with sudo.

Otherwise check if that port is not already being used by another service.

like image 45
Santiago M. Quintero Avatar answered Nov 15 '22 07:11

Santiago M. Quintero