Unable to bind to port 80


Installed a python based server. Server start throws error:

socker error; [Error 13] Permission denied.
It seems server unable to bind to port 80. If apache is already running on port 80, Is there a way to disable it and run my web server instead.


Binding to port 80 is messy, as only the root user can bind to ports under 1024.

It’s probably easier for you to use mod_proxy (available in the panel under https://panel.dreamhost.com/index.cgi?tree=domain.proxy) for this task.


Sorry to dig up the dead, here. I am looking for information on this topic (binding a custom process to port 80 on a DreamHost VPS) in order to make a purchasing decision regarding on-going use of a VPS with DreamHost.

Today I setup a VPS on a trial basis and been been messing around trying to get my custom webserver to work. I set “No Webserver” for my HTTP selection on the CPanel VSP | Configure Server page and had no trouble gaining root access and installing and fireing up my server. It seems to run fine when I bind it to 8080, however I get the same error unmesh mentions above when I try to bind it to port 80.

As additional context, I plan to host a custom web-service on this VPS that will need to own port 80. I understand that I can use mod_proxy (and also that this can be configured automagically via the panel) however, given that my charges for the Virtual Private Server will depend on the memory I provide to it, I’d rather not run Apache purely to proxy back to my separate (memory intense) daemon doing the actual work.

I understand from easier, but can I get some clue as to specifics around “messy”?


You have to run the server as root to bind to port 80, which makes it more of a pain to manage (since you have to use “sudo” to run stuff as the right user), as well as potentially opening you up to nastier things happening if your daemon gets exploited. If you can run the server as some non-root user, the potetial damage from an exploit is much more limited, and you can log in directly asthat user.

If you don’t want to have Apache running, I’d recommend running something lightweight like nginx to serve as a front-end proxy. It does still use some memory, but it shouldn’t take much more than a few hundred KB (And it’s worth it, as it can do useful things like terminating SSL, compressing output, and serving static content as well as proxying requests.)


I was attempting to run as root but still unable to bind to port 80.

Netstat didn’t reveal anything else listening on the port.

Even aside the memory use, adding a proxy brings in an additional ‘moving part’ to my system that is not value add.

I would really like to understand a solution where I can simply bind a custom service to port 80.


Hmm, that’s odd. If there isn’t any other web server running, you should be able to bind to port 80 as root without any problems.

Are you sure you’re running as root, though? Keep in mind that the “admin user” you create through the panel isn’t root-equivalent; it just has sudo privileges. If that isn’t it, go ahead and open up a Support ticket and we’ll have a look.


Yup, quite sure. I did whoami(1) and everything. From my sudo user I executed sudo su -, gave my password and had at.

Thanks much. No doubt PEBKAC however I appreciate the assistance.


Hrm. I logged into your VPS as root and was able to run this command briefly (and successfully) as a test:

Are you absolutely certain that your server isn’t doing something unexpected like switching to a non-root user when you launch it?


Yup, that was it. It had created a ‘service user’ and was trying to run it’s daemon under that UID.

Thanks Andrew.