Question about configuring vhosts in Linux.

Problems with the Linux version of XAMPP, questions, comments, and anything related.

Question about configuring vhosts in Linux.

Postby dmphotography » 02. January 2009 03:05

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.
For great video and written tutorials and guides on creating your own web server and installing things such as forums, blogs, etc., visit http://myownhomeserver.com
dmphotography
 
Posts: 191
Joined: 15. December 2008 14:25
Location: Columbus, MS
Operating System: Windows 7

Re: Question about configuring vhosts in Linux.

Postby glitzi85 » 05. January 2009 18:19

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
User avatar
glitzi85
 
Posts: 1920
Joined: 05. March 2004 23:26
Location: Dahoim

Re: Question about configuring vhosts in Linux.

Postby dmphotography » 06. January 2009 16:48

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.
For great video and written tutorials and guides on creating your own web server and installing things such as forums, blogs, etc., visit http://myownhomeserver.com
dmphotography
 
Posts: 191
Joined: 15. December 2008 14:25
Location: Columbus, MS
Operating System: Windows 7

Re: Question about configuring vhosts in Linux.

Postby glitzi85 » 06. January 2009 20:19

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
User avatar
glitzi85
 
Posts: 1920
Joined: 05. March 2004 23:26
Location: Dahoim


Return to XAMPP for Linux

Who is online

Users browsing this forum: No registered users and 7 guests