Virtual hosts file does not validate with WampServer, but does with Apache
Posted by: juiceboxint (---.taylorins.com)
Date: May 18, 2016 03:53PM

I am using xip.io and wildcard virtual hosts to allow for ad-hoc creation of new sites where they will be automatically allocated to a directory based on the hostname.

My virtual hosts hosts file validates with httpd -t, and I've been using it for a couple of hours and it's doing exactly what I want. However, it triggers four warnings with the new virtual hosts feature in WampServer. Here is the file:

-----

<VirtualHost *:80>
ServerName localhost
DocumentRoot C:/wamp/www
<Directory "C:/wamp/www/">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
</Directory>
</VirtualHost>

<Directory "c:/wamp/www/*">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>

<VirtualHost *:80>
# Apache will form URLs using the hostname supplied by the client
UseCanonicalName Off

# available aliases to use
ServerAlias *.192.168.1.100.xip.io

# where to put them
VirtualDocumentRoot "c:/wamp/www/%1/"
</VirtualHost>

-----

And here are the WampServer errors:

The number of DocumentRoot does not match the number of ServerName in C:/wamp/bin/apache/apache2.4.17/conf/extra/httpd-vhosts.conf file
The path c:/wamp/www/%1/ for DocumentRoot does not exist (File C:/wamp/bin/apache/apache2.4.17/conf/extra/httpd-vhosts.conf)
The path c:/wamp/www/* for <Directory ... does not exist (File C:/wamp/bin/apache/apache2.4.17/conf/extra/httpd-vhosts.conf)
The number of <VirtualHost does not match the number of ServerName in C:/wamp/bin/apache/apache2.4.17/conf/extra/httpd-vhosts.conf file

The errors do not affect me at all since I don't use the virtual server setup feature of WampServer - I just turned this feature off and the errors went away. But it does seem like this is something that should be corrected at some point - if valid virtual hosts are added directly to the file (even if they are type of virtual host that the tool does not support) then the tool should ignore them rather than saying they are invalid.

Options: ReplyQuote
Re: Virtual hosts file does not validate with WampServer, but does with Apache
Posted by: Otomatic (Moderator)
Date: May 18, 2016 04:12PM

Hi,

If you want to use Apache as a professional, install Apache directly, but do not use Wampserver that is not for professionals but gives to fans the ability to quite simply detect errors.
Maybe in the next version I would put an option not to detect errors VirtualHost, but it's not in my priorities.

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: Virtual hosts file does not validate with WampServer, but does with Apache
Posted by: juiceboxint (---.taylorins.com)
Date: May 18, 2016 04:27PM

Just to clarify, this is still just for local development - xip.io is an IP loopback service, basically so you can use a static hostname inside a network that can be seen by others on the network without the need for an internal DNS server. It's still invisible to the outside world.

I was just reporting that the WampServer index.php file does not handle wildcards or placeholders in the virtual hosts file and treats them as errors when in fact they are valid.

Options: ReplyQuote


Sorry, only registered users may post in this forum.