Virtualhost not working

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

Virtualhost not working

Postby mths » 13. December 2012 22:35

When I set up a virtual host is keeps redirecting me to the same as localhost (/opt/lampp/htdocs/). Why? My hosts looks like this:
Code: Select all
127.0.0.1   localhost
127.0.0.1   ym.local
127.0.1.1   W520

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

En my /opt/lampp/etc/extra/httpd-vhosts.conf looks like so:
Code: Select all
NameVirtualHost *:80
<VirtualHost *:80>
   DocumentRoot "/opt/lampp/htdocs/"
   ServerName localhost
   ServerAlias localhost
</VirtualHost>
<VirtualHost *:80>
    DocumentRoot "/opt/lampp/htdocs/m/ym7up/"
    ServerName ym.local
    ServerAlias ym.local
    <Directory "/opt/lampp/htdocs/m/ym7up/">
        Options Indexes FollowSymLinks Includes ExecCGI
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

The 'm' in htdocs/m/ym7up is a symlink. However, I just get routed to 'localhost' or /xampp/ so it seems to miss the whole thing.
This problem seems to pop up on several forums but I have not found one threat that ended in a solution (for me). Anyone a clue? What makes your virtual hosts work?
mths
 
Posts: 8
Joined: 05. December 2012 23:40
XAMPP Version: 5.6.3
Operating System: Ubuntu

Re: Virtualhost not working

Postby JonB » 14. December 2012 00:20

DocumentRoot "/opt/lampp/htdocs/m/ym7up/"

It is a poor practice to nest a new virtualhost inside another DocumentRoot.

A good place for a new DocumentRoot would be at the /opt/lampp level

i.e:
DocumentRoot "/opt/lampp/m/ym7up/"

Good Luck
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
XAMPP Version: 1.8.3-2
Operating System: Windows XP/7 - Fedora 15 1.7.7


Return to XAMPP for Linux

Who is online

Users browsing this forum: No registered users and 7 guests