Apache2 not restarting on ubuntu

apache-2.2ubuntu-9.10

I have installed apache 2 in ubuntu but when i try to restart it gives me this error

vmware@ubuntu:~$ sudo /etc/init.d/apache2 restart
 * Restarting web server apache2                                                apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
[Mon Apr 12 17:37:43 2010] [warn] NameVirtualHost *:80 has no VirtualHosts
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
[Mon Apr 12 17:37:43 2010] [warn] NameVirtualHost *:80 has no VirtualHosts

When i try http://localhost

Now i get this error

sudo /etc/init.d/apache2 restart
sudo: unable to resolve host ubuntu
 * Restarting web server apache2                                                apache2: apr_sockaddr_info_get() failed for ubuntu
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
apache2: apr_sockaddr_info_get() failed for ubuntu
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
(98)Address already in use: make_sock: could not bind to address [::]:80
(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 log

s

nothing comes

This is the netstat output


Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 localhost:postgresql    *:*                     LISTEN      -               
tcp        0      0 *:3389                  *:*                     LISTEN      -               
tcp        0      0 localhost:3350          *:*                     LISTEN      -               
tcp        0      0 *:ssh                   *:*                     LISTEN      -               
tcp        0      0 localhost:ipp           *:*                     LISTEN      -               
tcp6       0      0 localhost:postgresql    [::]:*                  LISTEN      -               
tcp6       0      0 [::]:microsoft-ds       [::]:*                  LISTEN      -               
tcp6       0      0 [::]:netbios-ssn        [::]:*                  LISTEN      -               
tcp6       0      0 [::]:5900               [::]:*                  LISTEN      1338/vino-server

and restarting apache now gives

sudo /etc/init.d/apache2 restart
sudo: unable to resolve host ubuntu
 * Restarting web server apache2                                                apache2: apr_sockaddr_info_get() failed for ubuntu
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
 ... waiting .apache2: apr_sockaddr_info_get() failed for ubuntu
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName

Best Answer

You seem to be missing a VirtualHost section even though you have a NameVirtualHost declaration in your configuration.

You either need to remove the NameVirtualHost line, or fix your virtual host configuration.

EDIT: With respect to your latest update - this means something else is running on port 80, and so Apache can't listen for connections on that port. You may have some other daemon (or perhaps a rogue Apache process) running.

You can run netstat --tcp --listening --programs to show all listening sockets as well as the application listening on each port. You'll be looking for *:www or *:80 in the "Local Address" column. Once you know the application listening on port 80, you can determine the best method of solving the problem.