Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm a n00b - trying to get apache2 set up on Ubuntu 9.10 (Karmic Koala) on Rackspace Cloud. I have set up/configured OpenSSL and installed Apache, but Apache won't start. I assume its a misconfiguration in my /etc/apache2/sites-available/ssl or /etc/apache2/sites-available/default files)

When I try to restart apache using the command:

sudo /etc/init.d/apache2 restart I get the following error message:

[error] (EAI 2)Name or service not known: Could not resolve host name *.80 -- ignoring! 
[error] (EAI 2)Name or service not known: Could not resolve host name *.80 -- ignoring! 
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80 no listening sockets available, shutting down 
Unable to open logs ...fail!

For my /etc/apache2/sites-available/ssl I have used a virtual host of *:443.

For my /etc/apache2/sites-available/default i have used a virtual host of *:80

share|improve this question
5  
look for the port conflict: netstat -an | grep 80 | grep LISTEN –  benc Dec 10 '10 at 2:20

3 Answers 3

The error messages speaks of .80 and not :80, look through all your configuration files to see if you have anything mentioning this. Doublecheck ServerName settings.

The final error means that a process is already using port 80 on your server, bound to one or all interfaces. To see which one, logon as root and type: netstat -nap | grep :80 and check what process it is, and kill it if its not supposed to be running. Most likely a dead/orphaned apache/httpd process that got stuck when you've started/restarted. Manually kill it if needed.

share|improve this answer

you should set your ServerName into the httpd.conf also make sure that the hostname is set - run uname -n

share|improve this answer

1) Run this command, It will retrive your server name.

uname -r

2) Copy your server name, then edit your apache conf file in order to define ServerName directive.
In Ubuntu or Debian: vim /etc/apache2/apache2.conf
Try to find ServerName Directive first, can be commented with #, if it's not present then add it.

ServerName yourservername

Also you have to check if you have defined Listen directive.

Listen *:80

3) Reload apache config:

/etc/init.d/apache2 reload

4) Restart apache:

/etc/init.d/apache2 restart

share|improve this answer
    
Instead of "Listen *:80", you can just do "Listen 80" for the same effect. –  alanthing Jan 26 '12 at 11:45
    
uname -r is for the linux version, you want 'uname -n' for the hostname, though running hostname or hostname --fqdn would be a more recommended way of getting this –  stew Feb 7 '12 at 21:20
    
I'd recommend editing httpd.conf instead of apache2.conf so that the apache2.conf can later be upgraded by the package –  stew Feb 7 '12 at 21:20
    
there is no sense in reloading apache if you are going to restart it anyway, unless you were just trying to get a configtest, in which case apache2ctl configtest –  stew Feb 7 '12 at 21:21

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.