Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm trying to set up a server with Kloxo and two virtual hosts. They are pointed to the same IP, but a different directory.

Here's the config of virtual host files. They're in different files, and included in the main httpd.conf file. NameVirtualHost *:80 is uncommented.

arturas.conf:

<VirtualHost *:80>
    ServerAdmin arturas@duomenucentras.lt
    DocumentRoot /home/.sites/_default/web
    ServerName arturas.duomenucentras.lt:80
    ScriptAlias /cgi-bin/ /home/.sites/_default/cgi-bin/
    ErrorLog /home/.sites/_default/logs/error_log
    TransferLog /home/.sites/_default/logs/access_log
    <Directory /home/.sites/_default/web>
        Options FollowSymLinks
        Options +Includes +ExecCGI
        AllowOverride All
    </Directory>
</VirtualHost>

donkapone.conf:

<VirtualHost *:80>
    ServerAdmin arturas@duomenucentras.lt
    DocumentRoot /home/.sites/donkapone/web
    ServerName www.donkapone.duomenucentras.lt:80
    ServerAlias donkapone.duomenucentras.lt:80
    ScriptAlias /cgi-bin/ /home/.sites/donkapone/cgi-bin
    <Directory /home/.sites/donkapone/web>
        Options FollowSymLinks
        Options +Includes +ExecCGI
        AllowOverride All
    </Directory>
</VirtualHost>

both of the sites show Kloxo Default Page as an error. Both of the subdomains, when pinged ping arturas.duomenucentras.lt

If you are seeing this page, it means that web has not been configured for this domain on this server.

This could be due to the following causes:

Kloxo has not restarted the web server yet after you added the domain. Please wait for the web server to restart.

The domain is pointing to the wrong Kloxo server. Ping the domain and make sure that the IP matches one of the IPaddress seen in admin home -> ipaddresses

If you are seeing this page when you try to access an IP like http://192.168.1.1, then that means that the IP has not yet been mapped to a domain. Go to client home -> ipaddresses -> ipaddress home -> domain config and map an IP to a domain.

Once you map an IP to a domain, then you have to make sure that the domain pings back to the same IP. Otherwise, if you try to access the domain, you will get this page. So IP -> domain.com should mean that domain.com pings to the same IP.

I'm guessing that's the root of the problems.

Any idea why does it do that?

share|improve this question

3 Answers 3

This looks a lot like a standard Apache config, but I have never used the :80 on the ServerName lines in mine.

The ping thing is normal, because you are using virtual hosts. This means they share the same IP address, so if you use the standard unix ping command that looks up the reverse address, then it will resolve to only one of the names (usually.)

Apache doesn't care about the reverse name, only the forward one.

share|improve this answer

The :80 isn't part of the server name, I'd remove that from the ServerName and ServerAlias values.

ping has nothing to do with your HTTP setup, what you are seeing is effectively the canonical name of the server don't worry about that.

share|improve this answer
    
I fixed the :80 in Servername and ServerAlias, and restarted apache, but Kloxo is still showing it's Default Page. I've updated the error in the original post. –  donkapone Nov 16 '10 at 9:43
    
How did you include arturas.conf in httpd.conf? –  RedGrittyBrick Nov 16 '10 at 10:12
    
Have you placed a different index.html in each ServerRoot? –  RedGrittyBrick Nov 16 '10 at 10:15
    
It's included like so: Include /etc/httpd/vhost/arturas.conf Include /etc/httpd/vhost/donkapone.conf And yes, two different sites are uploaded to home/.sites/_default/web and to /home/.sites/donkapone/web –  donkapone Nov 16 '10 at 10:16
    
It was working great, when it was only one site - the Kloxo Default Page appeared when I added another Virtual Host. –  donkapone Nov 16 '10 at 10:21

As heavily documented, the first-listed virtual host is always the default one when no other virtualhost matches the Host: header.

You are not requesting the ServerName or ServerAlias of the second vhost; hence, the first one is returned.

share|improve this answer

Your Answer

 
discard

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.