LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Could not bind to address 0.0.0.0:80 (https://www.linuxquestions.org/questions/linux-newbie-8/could-not-bind-to-address-0-0-0-0-80-a-405377/)

Linuxn00b 01-19-2006 09:37 AM

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.

ugenn 01-19-2006 09:56 AM

Is anything else listening on 80?

Linuxn00b 01-19-2006 09:58 AM

oh ya, I should have posted that...I don't know. How can I check?

Linuxn00b 01-19-2006 10:30 AM

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?

ugenn 01-19-2006 10:52 AM

Can anything else bind to port 80? Test with something like netcat.

dana340 01-19-2006 11:03 AM

did you upgrade from an earlier version of Apache, it's possible that the old installation is still bound to port 80.

haertig 01-19-2006 11:11 AM

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.

slyguyr3 02-23-2006 01:03 AM

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

sundialsvcs 02-23-2006 11:00 AM

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.

ugenn 02-24-2006 05:51 AM

Check httpd.conf for a "Listen" configuration line.

sysko 10-23-2006 06:29 AM

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,

ellen G 05-23-2007 08:12 PM

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. :cry: :cry: :cry: 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.

sreejithedl 04-21-2009 02:04 PM

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.

.

r3sistance 04-21-2009 06:03 PM

Quote:

Originally Posted by sundialsvcs (Post 2120120)
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.

sreejithedl 04-22-2009 07:10 AM

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


All times are GMT -5. The time now is 07:17 AM.