Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I was going to delete this question, but I couldn't because it has been answered. I am abandoning this question because I am going to replace my desktop install with a server install. We'll see if that fixes it.

I installed LAMP with apache2 on my Ubuntu 10.04 system. It works and serves files from /var/www. I followed the instruction found [here][1]. The new site username is selah and the domain name is selahsanctuary.org.

Here's my file, /etc/apache2/sites-enabled/selah

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
        ServerName selahsanctuary.org
        DocumentRoot /home/selah/public_html/
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    <Directory /home/selah/public_html/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
        AllowOverride None
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all

    ErrorLog /var/log/apache2/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog /var/log/apache2/access.log combined

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


I verified that /home/selah/public_html/index.html exists.

If I visit http://selahsanctuary.com, I get the file served from /var/www. I found a suggestion that I add /etc/apache2/conf.d/virtual.conf with this line: NameVirtualHost * but that caused an error so I removed it. Then I found a suggestion to add a line in /etc/host like selahsanctuary.org. I did and restarted apache2. No help. So finally, I ask, what should I try next? Do I have a typo somewhere?

I tried to simplify and found another sample of a site-available file like this:

<VirtualHost selahsanctuary.org>
ServerAdmin webmaster@localhost
#We want to be able to access the web site using www.selahsanctuary.org or selahsanctuary.org
ServerAlias www.selahsanctuary.org
DocumentRoot /home/selah/public_html

#we want specific log file for this server
CustomLog /home/selah/selah-access.log combined

and I edited my /etc/hosts file so there is now a line like this: localhost www.selahsanctuary.org selahsanctuary.org but it still serves the file from /var/www (I did remember to a2ensite selah and /etc/init.d/apache2 reload)

share|improve this question
Checking typo, will repost in a moment. – TecBrat Sep 5 '12 at 2:05
Well, I realized I was using the .com TLD but I actually have that set up at my registrar to redirect to the .org version. I went back and edited my /etc/apache2/sites-available/selah file, disabled it, restarted apache, enabled it, restarted apache again, and it still does not work. I just considered the possibility that an install of webmin might be conflicting. I'll uninstall and test again. – TecBrat Sep 5 '12 at 2:38

The NameVirtualHost directive is essential if you want to use name-based virtual hosts. What error message did you get when you tried it?

Try NameVirtualHost *:80 rather than just NameVirtualHost * and make sure that the vhost definition starts with <VirtualHost *:80> to match.

The VirtualHost definition will also require a ServerName and optionally one or more ServerAlias directives.

Also, read the Apache docs on Name-based Virtual Host Support and vhosting in general.

BTW, cargo-culting stuff into your /etc/hosts file is not a good idea (cargo-culting never is - if you don't understand it, don't copy-paste it). If you've got a DNS problem, then fix your DNS. Except as part of a temporary debugging effort, don't just work around it with edits to /etc/hosts - that will only "work" on that one machine.

share|improve this answer
I'm such a newb at some of this that some of what you call "cargo-culting" is the only way to move forward. I'll get the knowledge along the way. I was thinking that the hosts file might be local only. Windows uses the same name for their version. I'll put it back to default. The error I had with NameVirtualHost was "mixing * ports and non-* ports with a NameVirtualHost address is not supported" I'll also take a look at the links you gave. Thanks. – TecBrat Sep 5 '12 at 9:59
The answer Craig Sanders gave should fix that error message. – Jenny D Sep 5 '12 at 10:04
I'm still working on it. Now I get # /etc/init.d/apache2 reload [linebreak]* Reloading web server config apache2[linebreak] apache2: Could not reliably determine the server's fully qualified domain name, using for ServerName[linebreak][Wed Sep 05 06:38:22 2012] [warn] NameVirtualHost *:80 has no VirtualHosts – TecBrat Sep 5 '12 at 10:42
Got to go to work. This is a home project. Have to try again tonight. – TecBrat Sep 5 '12 at 10:44
the second warning means that you have a NameVirtualHosts *:80 but you don't have any <VirtualHost *:80> vhosts - you probably forgot to change it at the same time. do that and reload apache again. – cas Sep 5 '12 at 12:10

Your Answer


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.