apache virtual host problem

Aart Koelewijn aart at mtack.xs4all.nl
Tue Feb 5 11:40:56 UTC 2008


On Mon, 04 Feb 2008 16:47:24 -0500, Ashley Benton wrote:

> I added the lines in /etc/hosts, so now when I try
> http://theswebsite.com(secondwebsite) on the computer that is the
> server, it shows me my first
> site, the same thing happen when I try http://www.linuxabcd.org. If
> instead of http://www.linuxabcd.org I try file://www.linuxabcd.org, I
> see my file system.
> 
> When I try from the Windows computer I can find only the first site I
> tried http://192.168.0.105, goes to the first website (seems logical to
> me)
> http://192.168.0.105/www.theswebsite.com the webpage cannot be found. It
> does the same with file://192.168.0.105/www.theswebsite.
> 
> I tried apache2 -S in the terminal and this is the result: VirtualHost
> configuration:
> wildcard NameVirtualHosts and_default_servers: *:*                      
>           is a NameVirtualHost
>        default server myfirstsite.com
>        (etc/apache2/sites-enabled/mysite:2) port * namevhost
>        myfirstsite.com(/etc/apache2/sites-enabled/mysite:2)
> Syntax OK
> 
> It apparently recognizes only one server name which is the name of the
> first website.
> Is there anything except writing name server and server alias in the
> virtual host files that I should have done?
> I have now 192.168.0.105 www.linuxabcd.org and
> <http://www.linuxabcd.org/> 192.168.0.105 name.second.domain defined in
> /etc/hosts Thank you
> Meg
> 

Dear Meg,

I can't exactly follow what you have done, but I also have a apache2 
server with 2 virtual hosts running on one computer. I'll give you the 
bare essentials off my set-up, maybe that will help:

In /etc/apache2/httpd.conf:

Include /etc/apache2/sites-enabled/

(this is the last line in that file)

In /etc/apache2/sites-enabled/mtack.xs4all.nl

NameVirtualHost *:80
<VirtualHost *:80>
        ServerAdmin aart at mtack.xs4all.nl
        ServerName mtack.xs4all.nl
        DocumentRoot /home/public
</VirtualHost>
<VirtualHost *:80>
        ServerAdmin aart at energiekeuring.com
        ServerName www.energiekeuring.com
        DocumentRoot /home/energie
</VirtualHost>

        <Directory /home/public>
                Options -FollowSymLinks +MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>

        <Directory /home/energie>
                Options -FollowSymLinks +MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>

Both virtual servers are viewable from the computers in my home-network. 
I remember I had some problems with that with a previous server, which, 
as far as I can remember, I solved in the way I wrote before. Now I have 
a name-server running on this computer and as far as I can see, that is 
the only thing I needed. An other way is, to use a external proxy 
somewhere. Probably your ISP will have a proxy-server you can use.

-- 
Aart





More information about the ubuntu-users mailing list