1

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

sysadmin1138
  • 133,124
  • 18
  • 176
  • 300
william
  • 11
  • 1
  • 2

3 Answers3

2

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.

Mattias Ahnberg
  • 4,139
  • 19
  • 19
0

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

silviud
  • 2,687
  • 2
  • 18
  • 19
0

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

Matias Dominoni
  • 337
  • 1
  • 4
  • Instead of "Listen *:80", you can just do "Listen 80" for the same effect. – Alan Ivey 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 07 '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 07 '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 07 '12 at 21:21