# "48: Address already in use" error

**URL:** <https://www.ruby-forum.com/t/48-address-already-in-use-error/211646>\
**Category:** NGINX\
**Created:** [September 9, 2011, 5:19pm UTC](https://www.ruby-forum.com/t/48-address-already-in-use-error/211646 "2011-09-09T17:19:03Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [September 9, 2011, 5:19pm UTC](https://www.ruby-forum.com/t/48-address-already-in-use-error/211646/1 "2011-09-09T17:19:03Z")

</div>

This is the error message I get when I try to run nginx:

nginx: [emerg] bind() to 0.0.0.0:80 failed (48: Address already in use)  
nginx: [emerg] bind() to 0.0.0.0:80 failed (48: Address already in use)  
nginx: [emerg] bind() to 0.0.0.0:80 failed (48: Address already in use)  
nginx: [emerg] bind() to 0.0.0.0:80 failed (48: Address already in use)  
nginx: [emerg] bind() to 0.0.0.0:80 failed (48: Address already in use)  
nginx: [emerg] still could not bind()

I have disabled apache, so it’s not that. Previous to this, I  
uninstalled nginx (using mac osx snow leopard), but 0.0.0.0 and  
127.0.0.1 were still displaying “Welcome to nginx”. I then re-installed  
nginx and I have been trying to run it, but I am getting these errors.

I’ve tried checking what is on port 80 with this:  
$ sudo lsof -i:80  
but nothing is returned.

0.0.0.0:80 displays: “404 Not Found nginx/1.0.6”

Output of “ps ax -o pid,ppid,%cpu,vsz,wchan,command|egrep  
‘(nginx|PID)’”

> PID PPID %CPU VSZ WCHAN COMMAND  
> 35198 1 0.0 2435856 - nginx: master process nginx  
> 35199 35198 0.0 2436044 - nginx: worker process  
> 41669 32470 0.0 2425524 - egrep (nginx|PID)

nginx.conf can be found here: [nginx.conf file - Pastebin.com](http://pastebin.com/Rq8vKHXn)

Would anyone happen to know how to resolve this?

Thank you in advance.

Posted at Nginx Forum:

> **["48: Address already in use" error](https://forum.nginx.org/read.php?2,215031,215031#msg-215031)**
>
> This is the error message I get when I try to run nginx: nginx: \[emerg\] bind() to 0.0.0.0:80 failed (48: Address already in use) nginx: \[emerg\] bind() to 0.0.0.0:80 failed (48: Address already in use) nginx: \[emerg\] bind() to 0.0.0.0:80 failed (48:...

---

<div class="post-metadata">

**Author:** ![ynasser](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/fbc32d/32.png) [@ynasser](https://www.ruby-forum.com/u/ynasser)\
**Post date:** [September 9, 2011, 5:22pm UTC](https://www.ruby-forum.com/t/48-address-already-in-use-error/211646/2 "2011-09-09T17:22:09Z")

</div>

you probably still have an nginx running and listening on localhost  
port 80. what do you mean with install/uninstall, how did you do that?  
after uninstalling did you make sure the running process is also dead?

try to “sudo killall nginx” and then try to run it again.

---

<div class="post-metadata">

**Author:** ![ynasser](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/fbc32d/32.png) [@ynasser](https://www.ruby-forum.com/u/ynasser)\
**Post date:** [September 9, 2011, 5:27pm UTC](https://www.ruby-forum.com/t/48-address-already-in-use-error/211646/3 "2011-09-09T17:27:06Z")

</div>

$ sudo killall nginx  
Password:  
No matching processes were found

When I try to run it, the same error occurs.

To uninstall it, since there was no “easy” way to remove it, I just  
removed every file or folder which contained any nginx in its title or  
anywhere in the contents. There didn’t seem to be any other way to  
remove it.

The first time I installed it, I did a manual install. The second time I  
used: “sudo port install nginx”.

Posted at Nginx Forum:

> **[Re: "48: Address already in use" error](https://forum.nginx.org/read.php?2,215031,215033#msg-215033)**
>
> This is the error message I get when I try to run nginx: nginx: \[emerg\] bind() to 0.0.0.0:80 failed (48: Address already in use) nginx: \[emerg\] bind() to 0.0.0.0:80 failed (48: Address already in use) nginx: \[emerg\] bind() to 0.0.0.0:80 failed (48:...

---

<div class="post-metadata">

**Author:** ![ynasser](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/fbc32d/32.png) [@ynasser](https://www.ruby-forum.com/u/ynasser)\
**Post date:** [September 9, 2011, 7:40pm UTC](https://www.ruby-forum.com/t/48-address-already-in-use-error/211646/4 "2011-09-09T19:40:07Z")

</div>

Did you check your process using ps -ef | grep nginx

Does it list any of the nginx process running? If yes then kill each one  
of those and re-check it using above command.

ynasser wrote in post #1020988:

> $ sudo killall nginx  
> Password:  
> No matching processes were found
> 
> When I try to run it, the same error occurs.
> 
> To uninstall it, since there was no “easy” way to remove it, I just  
> removed every file or folder which contained any nginx in its title or  
> anywhere in the contents. There didn’t seem to be any other way to  
> remove it.
> 
> The first time I installed it, I did a manual install. The second time I  
> used: “sudo port install nginx”.
> 
> Posted at Nginx Forum:  
> [http://forum.nginx.org/read.php?2,215031,215033#msg-215033](http://forum.nginx.org/read.php?2,215031,215033#msg-215033)

---

<div class="post-metadata">

**Author:** ![ynasser](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/fbc32d/32.png) [@ynasser](https://www.ruby-forum.com/u/ynasser)\
**Post date:** [September 9, 2011, 7:52pm UTC](https://www.ruby-forum.com/t/48-address-already-in-use-error/211646/5 "2011-09-09T19:52:36Z")

</div>

Thank you! It works now. It’s a little weird that ‘ps -A | grep nginx’  
wasn’t catching the other processes though, since -e is identical to -A.

Posted at Nginx Forum:

> **[Re: "48: Address already in use" error](https://forum.nginx.org/read.php?2,215031,215037#msg-215037)**
>
> This is the error message I get when I try to run nginx: nginx: \[emerg\] bind() to 0.0.0.0:80 failed (48: Address already in use) nginx: \[emerg\] bind() to 0.0.0.0:80 failed (48: Address already in use) nginx: \[emerg\] bind() to 0.0.0.0:80 failed (48:...
