Page 1 of 1

Question about configuring vhosts in Linux.

PostPosted: 02. January 2009 03:05
by dmphotography
Hey there,
I successfully installed and configured Xampp for Linux 1.7 in Ubuntu 8.10. I then proceeded to setup my virtual hosts and do a test on hosting 2 separate domains via name. Unfortunately, the method for doing so apparently isn't identical to setting it up in Windows.

So here's what I've done so far.

I went to httpd.conf and searched for the following line:

Code: Select all
Include etc/extra/httpd-vhosts.conf


I removed the "#" from in front of it, then saved the file.

Next, I opened httpd-vhosts.conf and deleted everything in it and added the following:

Code: Select all
NameVirtualHost *:80

<VirtualHost *:80>
    DocumentRoot /opt/lampp/htdocs/
    ServerName davesforum.info
    ServerAlias www.davesforum.info
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot /opt/lampp/htdocs2/
    ServerName myownserver.info
    ServerAlias www.myownserver.info
<Directory /opt/lampp/htdocs2/>
Options Indexes +FollowSymLinks Include ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

NameVirtualHost 127.0.0.1

<VirtualHost 127.0.0.1>
    ServerName localhost
    DocumentRoot /opt/lampp/htdocs/
</VirtualHost>


**EDIT**
Ok, I found my problem in apachestart.log .

It turns out the lines:
Code: Select all
<Directory /opt/lampp/htdocs2/>
Options Indexes +FollowSymLinks Include ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>

will not work for Linux.

My question is, are those lines just not necessary for Linux or is there a different format for them?

Thanks in advance.

Re: Question about configuring vhosts in Linux.

PostPosted: 05. January 2009 18:19
by glitzi85
Code: Select all
NameVirtualHost *:80

<VirtualHost *:80>
    DocumentRoot /opt/lampp/htdocs/
    ServerName davesforum.info
    ServerAlias www.davesforum.info
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot /opt/lampp/htdocs2/
    ServerName myownserver.info
    ServerAlias www.myownserver.info
    <Directory /opt/lampp/htdocs2/>
        Options Indexes +FollowSymLinks Include ExecCGI
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>


The 127.0.0.1 part below your new VirtualHosts was wrong. You can not use * and an ip at the same time for NameVirtualHost. Also it would not make sense to bind localhost to 127.0.0.1 and use the same directory for another domain.

I deleted localhost totally from your code, as every unknown hostname will be served like the first VirtualHost.

glitzi

Re: Question about configuring vhosts in Linux.

PostPosted: 06. January 2009 16:48
by dmphotography
Ahhh, ok, I see what you mean.

Thank you!

So the permissions and the rest I have still work the same as Windows Apache then, right?

I'm trying to learn the differences between Linux and Windows servers so I can get comfortable working in Linux.

Re: Question about configuring vhosts in Linux.

PostPosted: 06. January 2009 20:19
by glitzi85
From the Apaches configuration side of view there is no difference between Linux and Windows. You could use the same configuration file for Linux and Windows, if you would use the same paths.

The only differences you have is what Worker is used. AFAIR you cannot use one of them on another OS (Prefork will not work under Windows for example). But this will be handled by the If-Constructs in the configuration file.

glitzi