I have just installed ubuntu (11.04).

I have installed apache/mysql/php etc.

I have a few sites sitting in


I want to be able to access these at



so now I have

These all look like (with appropriate sitex names)

<VirtualHost site1.local>
    ServerAdmin webmaster@localhost

    DocumentRoot /var/www/site1
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    <Directory /var/www/site1/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all

        AllowOverride None
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all

    ErrorLog ${APACHE_LOG_DIR}/error.log

    # alert, emerg.
    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/access.log combined

    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from ::1/128


In the terminal I then call



When I run the reload command I get

  • Reloading web server config apache2
    using for ServerName

Based on your hosts file, you map this line:

<VirtualHost site1.local>

to this:


What you want is:

<VirtualHost *:80>
    ServerName site1.somesite.com

You may also need:

NameVirtualHost *:80

  • To elaborate on this, the reason that this is the case is that the bind address for the VirtualHost must match the NameVirtualHost statement, which is probably in your ports.conf file. See here for reference. – Shane Madden Apr 15 '11 at 1:32

I faced the same problem. After multiple trial and errors, I fixed the issue by adding NameVirtualHost *:80 to sites-available/default. And removing/not-adding the same line in any other files in sites-available/

I don't know why that worked though.


The error message of: "Could not reliably determine the server's fully qualified domain name..." is a quirky issue in the apache2 server and would not prevent or stop the apache2 server from locally "VirtualHost" ing your "ServerName". Read the link that Shane Madden gave as the solution is in there. The other "warn" message of: "NameVirtualHost *:80 has no VirtualHosts" will prevent you from having success.

Problem 1: The solution to the FQDN is simple and the two solutions seems to each have success for different users - so do both: Add the text string "ServerName localhost" (without quotes) to either (or both) of two files; the /etc/apache2/http.d.conf file, which is blank out of the box. And add it at the bottom of the /etc/apache2/apache2.conf file.

Problem 2: Reading the manual you will see examples on various setups for Apache2, but the one thing you really need to keep in mind is that the directive "NameVirtualHost" (which is located in /etc/apache2/ports.conf) needs to be EXACTLY the same as what you specify in the directive (located in the etc/apache2/sites-available/siteFile, where "siteFile" is your "site1", "site2" and "site3" in your example). Don't use boolean values in one and a static IP address or a static IP:Port in another. Once you understand the severity of that relationship then reading the manual and trying their setups will work.

Problem 3: The hidden problem: Knowing Problem 2, you now need to make sure it does not happen in your OTHER site files - namely, your default file. If the Default file has a VirtualHost *:80 and your site1 has a VirtualHost AND your ports.conf has a NameVirtualHost then the site1 and ports.conf are in harmony BUT the default is now no longer good and will cause the error.

Hang in there! It ain't easy...

Your Answer

