2

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

3 Answers3

3

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.

Matthew Iselin
  • 717
  • 1
  • 8
  • 20
  • I have not added any vitual host , its just the fresh install of ubuntu. How can fix that –  Apr 13 '10 at 01:02
  • `sudo a2ensite default` might fix an error in the default setup of Apache on Ubuntu. Alternatively, remove the `NameVirtualHost *:80` line in /etc/apache2/ports.conf. – Matthew Iselin Apr 13 '10 at 02:00
1

apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName

Edit /etc/hostname or use a ServerName directive if you don't need to serve multiple websites on a single machine to fix that error.

To hit up the rest of the errors, look at /etc/apache2/sites-enabled for your configuration. There should be a default site just serving up /var/www.

jldugger
  • 14,342
  • 20
  • 77
  • 129
  • yes there are two default sites , 000-default and other is matrix , what should i do next –  Apr 13 '10 at 06:14
1

Check here: Setting Up Name Based Virtual Hosting.

To find out what else is tying up port 80, run this:

netstat -lnp | grep :80

Then you can do something like killall -9 [process-name] and try restarting again.