LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 01-19-2006, 09:37 AM   #1
Linuxn00b
LQ Newbie
 
Registered: Jan 2006
Posts: 4

Rep: Reputation: 0
Could not bind to address 0.0.0.0:80


When i try to run apache2 I get this error.

(13) Permission Denied: make_sock: Could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
unable to open logs

Now, Apache was working fine a month ago because I had been to the website. Now I'm working for the people who made the website, and guess what, I have to fix it. Problem is, I'm not super new to linux, I have done linux before, but never tried troubleshooting it before.

Now i checked the httpd.conf file. It's not set to bind to 0.0.0.0:80, its set for a proper address. It's also set to "Listen 80". I can't seem to find the fix I need for this error when I try to restart apache2 (apachectl start). I have also tried to start apachectl from root, but that didn't work either.

Anyone have any ideas here?

Thanks.

Last edited by Linuxn00b; 01-19-2006 at 09:38 AM.
 
Old 01-19-2006, 09:56 AM   #2
ugenn
Member
 
Registered: Apr 2002
Posts: 549

Rep: Reputation: 30
Is anything else listening on 80?
 
Old 01-19-2006, 09:58 AM   #3
Linuxn00b
LQ Newbie
 
Registered: Jan 2006
Posts: 4

Original Poster
Rep: Reputation: 0
oh ya, I should have posted that...I don't know. How can I check?
 
Old 01-19-2006, 10:30 AM   #4
Linuxn00b
LQ Newbie
 
Registered: Jan 2006
Posts: 4

Original Poster
Rep: Reputation: 0
OK, I did a variety of netstat commands, nothing seems to be showing up as port 80. I'm not sure if the netstat command is the best way to check for items that may be listening on port 80, does any have a better way to check?
 
Old 01-19-2006, 10:52 AM   #5
ugenn
Member
 
Registered: Apr 2002
Posts: 549

Rep: Reputation: 30
Can anything else bind to port 80? Test with something like netcat.
 
Old 01-19-2006, 11:03 AM   #6
dana340
LQ Newbie
 
Registered: Nov 2005
Posts: 18

Rep: Reputation: 0
did you upgrade from an earlier version of Apache, it's possible that the old installation is still bound to port 80.
 
Old 01-19-2006, 11:11 AM   #7
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD
Posts: 1,996

Rep: Reputation: 302Reputation: 302Reputation: 302Reputation: 302
Quote:
Originally Posted by Linuxn00b
When i try to run apache2 I get this error.

(13) Permission Denied: make_sock: Could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
unable to open logs
Are you starting Apache as root? "Permission denied" indicates you're not root. Only root can bind to lower ports, like port 80. You never want to actually run Apache as root, but it must start up that way (for standard port 80) and then switch to a different userid. If some other program was already bound to port 80 you would get a "could not bind..." error, but I don't think it would not be prefaced with a "permission denied" error like you're seeing.
 
Old 02-23-2006, 01:03 AM   #8
slyguyr3
LQ Newbie
 
Registered: Nov 2003
Distribution: Mandrake 9.1
Posts: 4

Rep: Reputation: 0
changing to port 81

My isp blocks 80 so I am just trying to use 81. How would I make apache start as root as you suggest?

Thanks
 
Old 02-23-2006, 11:00 AM   #9
sundialsvcs
Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 5,346

Rep: Reputation: 1104Reputation: 1104Reputation: 1104Reputation: 1104Reputation: 1104Reputation: 1104Reputation: 1104Reputation: 1104Reputation: 1104
What's making me suspicious is not the ":80" but the "0.0.0.0." It sounds like Apache has not been told what adapter to listen to.

Apache normally listens to port #80 and this is a "low-numbered port," which customarily requires root. Under normal installations it will typically do so... starting as root long enough to open the port, then switching to another user.
 
Old 02-24-2006, 05:51 AM   #10
ugenn
Member
 
Registered: Apr 2002
Posts: 549

Rep: Reputation: 30
Check httpd.conf for a "Listen" configuration line.
 
Old 10-23-2006, 06:29 AM   #11
sysko
LQ Newbie
 
Registered: Jan 2006
Posts: 1

Rep: Reputation: 0
cannot bind to 0.0.0.0:80

In my case the problem was related to a VirtualHost trying to bind to port 80. It was like httpd would start and bind on port 80 but as soon as the VHOST would start it was trying to bind also to port 80, making the service stop because of the port was in use.

here is my faulty /etc/apache2/httpd.conf file with the 2 overlapping lines that were causing the issue:
Quote:
Listen *:80

KeepAlive on
HostNameLookups on
ServerAdmin admin@my_own_domain_name
ServerName frodo.midearth.local

/usr/lib/apache2/modules/mod_placeholder.so
<VirtualHost my_own_domain_name:80>
DocumentRoot "/var/www/vhost/my_own_domain_name/httpdocs"
ServerName frodo.midearth.local
<Directory "/var/www/vhost/my_own_domain_name/httpdocs">
allow from all
Options +Indexes
</Directory>
</VirtualHost>
The issue was fixed by commenting the first line at the top:
#Listen *:80

Problem is gone, server can start normaly Dirty fix?

Regards,
 
Old 05-23-2007, 08:12 PM   #12
ellen G
LQ Newbie
 
Registered: May 2007
Posts: 3

Rep: Reputation: 0
How about these methods? (I have not tried them out.)

I got exactly the same problem after I upgrade from ubuntu 6.10 to 7.04. I reinstall the whole system again and agin and tried many ways but still can not solve this problem. My apache 2 now can not let firefox to reading in php files. After seraching on the web I found this link:

http://ubuntuforums.org/showthread.php?t=253859

In that post one guy says:
"turns out all i needed was a folder called 'logs' in the root dir of the hosted files (/var/log/www/). i'm not sure if i needed to create the file 'error.log' in the 'logs' folder or not, but doing so caused the problem to go away. after creating said folder and file, run sudo /etc/init.d/apache2 restart and i'm back up and running."

Note that I have not yet tried them out. I plan to reinstall all things including the system again when I come back from my vocation.

Hope this method is useful and let's try together to have this problem solved.

Last edited by ellen G; 05-23-2007 at 08:15 PM.
 
Old 04-21-2009, 02:04 PM   #13
sreejithedl
LQ Newbie
 
Registered: Apr 2009
Posts: 7

Rep: Reputation: 0
could not bind to address 0.0.0.0 80 no listening sockets available fix

Fix:-
=====================
1)Kill All nobody process. Use the following script for doing that.

root@del [~]#for i in `ps auwx | grep -i nobody | awk {'print $2'}`; do kill -9 $i; done
or
root@del [~]#for i in `lsof -i :80 | grep http | awk {' print $2'}`; do kill -9 $i; done

2) If apache is not restarting after this. Remove semaphore using the following script.

root@del [~]#for i in `ipcs -s | grep nobody | awk '{print $2}'`; do ipcrm -s $i; done

3) Restart apache.

.
 
Old 04-21-2009, 06:03 PM   #14
r3sistance
Senior Member
 
Registered: Mar 2004
Location: UK
Distribution: CentOS 5.4, Mac OS 10.4 (tiger)
Posts: 1,005

Rep: Reputation: 79
Quote:
Originally Posted by sundialsvcs View Post
What's making me suspicious is not the ":80" but the "0.0.0.0." It sounds like Apache has not been told what adapter to listen to.
I believe 0.0.0.0 is used when a site can be accessed via any ip that the server may use, after all a computer can have more then 1 ip. I would say it's either a conflict over port 80 (either with another process or an older version of apache) or apache isn't being started as a root process, I can't imagine it being anything else to be honest.
 
Old 04-22-2009, 07:10 AM   #15
sreejithedl
LQ Newbie
 
Registered: Apr 2009
Posts: 7

Rep: Reputation: 0
hi renesence.

Hello,

Here in this case port 80 may be used by some other process.
So i killed all the process which is bound to port 80.
and restarted apache. I am sure that the script will work fine.
You can get me at sreejithedl@gmail.com
Have a nice day.

Regards
Sreejith
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:443 bruvajon Linux - Software 34 11-30-2011 03:08 PM
Bind : address already in use on solaris blackhole123 Solaris / OpenSolaris 2 12-14-2005 05:38 AM
how can i remove an address bind sibu_rajappan Linux - Networking 0 12-24-2004 01:50 AM
bind : Address already in use sheni Linux - Networking 1 11-11-2004 12:41 PM
cannot bind to socket: address already in use exfacior Linux - Wireless Networking 0 09-27-2004 12:34 PM


All times are GMT -5. The time now is 02:16 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration