add_vhost confuses project-paths
Posted by: martin__ (---.pitcom.net)
Date: December 15, 2021 04:20PM

Hi,
I have a weird problem with the v-hosts on wamp. I use mostly the add_vhost.php-file to modify my httpd-vhosts.conf.

add_vhost shows for example the following configuration:

ServerName : www.project-a.local - Directory : c:/wamp/www/projects/project-b/htmldocs

so the domain and path are wrong. seemingly project-a points to the project-b-folder. However the httpd-vhosts.conf-file configuration is correct:


<VirtualHost *:80>
ServerName www.project-a.local
DocumentRoot "c:/wamp/www/projects/project-a/htmldocs"
<Directory "c:/wamp/www/projects/project-a/htmldocs/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>

Furthermore, on calling [www.project-a.local] the Server can not process the request.

Is there an different config file, where the vhosts are cached? I don't know where it gets the wrong path from...

Thanks

Options: ReplyQuote
Re: add_vhost confuses project-paths
Posted by: Otomatic (Moderator)
Date: December 15, 2021 05:06PM

Hi,

Clear the browser cache (Ctrl-F5)

Also be aware of the presence of an .htaccess file at the root of the sites, it may be it that performs a "transparent" redirection.

And don't forget the "DNS Restart" after the creation of each VirtulaHost.

Please post here the contents of :
- wamp64\bin\apache\apache2.4.xy\conf\extra\httpd-vhosts.conf
-C:\Windows\System32\drivers\etc\hosts

------------------------------------------------------------------------------------------------------------
Wampserver 3.2.8 32 bit - Apache 2.4.52 - PHP 8.1.2…5.6.40 - MySQL 5.7.37 - MariaDB 10.5.13/10.6.5
Wampserver 3.2.8 64 bit - Apache 2.4.52 - PHP 8.1.2…5.6.40 - MySQL 5.7.37/8.0.28 - MariaDB 10.5.13/10.6.5
PhPMyadmin 5.1.2 - MysqlDumper 1.24.5
on W10 and W7 Pro 64 bit
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons
« Ce n'est pas parce qu'ils sont nombreux à avoir tort, qu'ils ont forcément raison. Coluche »
« It's not because they are many to be wrong, they are necessarily right. Coluche »



Edited 1 time(s). Last edit at 12/15/2021 05:20PM by Otomatic.

Options: ReplyQuote
Re: add_vhost confuses project-paths
Posted by: martin__ (---.pitcom.net)
Date: December 16, 2021 09:46AM

Hi,

ok, so the project-a entry in the hosts-file was missing. I've added it:


127.0.0.1 www.project-a.local
::1 www.project-a.local

Also there were a few false entries like:


127.0.0.1 www.
::1 www.


127.0.0.1 www..local
::1 www..local

I've removed those and restarted wamp-Server + DNS. Now the www.project-a.local is callable.
However, on takeing a closer look at the add_vhost.php output, there seems to be an offset between domain and path after project-a (on all my browsers):

ServerName : www.project-a.local - Directory : c:/wamp/www/projects/project-a/htmldocs
ServerName : www.alias1-project-a.local - Directory : c:/wamp/www/projects/project-a/htmldocs
ServerName : www.alias2-project-a.local - Directory : c:/wamp/www/projects/project-a/htmldocs
ServerName : www.project-b.local - Directory : c:/wamp/www/projects/project-a/htmldocs
ServerName : www.project-c.local - Directory : c:/wamp/www/projects/project-b/htmldocs
ServerName : www.project-d.local - Directory : c:/wamp/www/projects/project-c/htmldocs


httpd-vhosts.conf seems correct

# Virtual Hosts
#
<VirtualHost *:80>
ServerName localhost
ServerAlias localhost
DocumentRoot "${INSTALL_DIR}/www"
<Directory "${INSTALL_DIR}/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
#
#
#
<VirtualHost *:80>
ServerName www.project-a.local
DocumentRoot "c:/wamp/www/projects/project-a/htmldocs"
<Directory "c:/wamp/www/projects/project-a/htmldocs/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
#
<VirtualHost *:80>
ServerName www.alias1-project-a.local
DocumentRoot "c:/wamp/www/projects/project-a/htmldocs"
<Directory "c:/wamp/www/projects/project-a/htmldocs/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
#
<VirtualHost *:80>
ServerName www.alias2-project-a.local
DocumentRoot "c:/wamp/www/projects/project-a/htmldocs"
<Directory "c:/wamp/www/projects/project-a/htmldocs/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
#
<VirtualHost *:80>
ServerName www.project-b.local
DocumentRoot "c:/wamp/www/projects/project-b/htmldocs"
<Directory "c:/wamp/www/projects/project-b/htmldocs/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
#
<VirtualHost *:80>
ServerName www.project-c.local
DocumentRoot "c:/wamp/www/projects/project-c/htmldocs"
<Directory "c:/wamp/www/projects/project-c/htmldocs/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
#
<VirtualHost *:80>
ServerName www.project-d.local
DocumentRoot "c:/wamp/www/projects/project-d/htmldocs"
<Directory "c:/wamp/www/projects/project-d/htmldocs/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>

Options: ReplyQuote
Re: add_vhost confuses project-paths
Posted by: Otomatic (Moderator)
Date: December 16, 2021 11:41AM

Hi,

Why Require all granted for localhost ?

> there seems to be an offset between domain and path after project-a (on all my browsers):
I don't understand what you mean!

------------------------------------------------------------------------------------------------------------
Wampserver 3.2.8 32 bit - Apache 2.4.52 - PHP 8.1.2…5.6.40 - MySQL 5.7.37 - MariaDB 10.5.13/10.6.5
Wampserver 3.2.8 64 bit - Apache 2.4.52 - PHP 8.1.2…5.6.40 - MySQL 5.7.37/8.0.28 - MariaDB 10.5.13/10.6.5
PhPMyadmin 5.1.2 - MysqlDumper 1.24.5
on W10 and W7 Pro 64 bit
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons
« Ce n'est pas parce qu'ils sont nombreux à avoir tort, qu'ils ont forcément raison. Coluche »
« It's not because they are many to be wrong, they are necessarily right. Coluche »

Options: ReplyQuote
Re: add_vhost confuses project-paths
Posted by: martin__ (---.pitcom.net)
Date: December 16, 2021 12:08PM

> Why Require all granted for localhost ?
I don't know. That is not necessary.

By "offset" I mean, that
project-b has the path to project-a
AND
project-c has the path to project-b
and so on - all the way down. Obviously that is not what the vhost-configuration says, but that is what add_vhost.php wants me to believe...

If I call www.project-b.local in the browser, the correct path is used - it works fine. Just the add_vhost.php shows wrong paths.

Options: ReplyQuote
Re: add_vhost confuses project-paths
Posted by: Otomatic (Moderator)
Date: December 16, 2021 01:21PM

Hi,

>> Why Require all granted for localhost ?
> I don't know. That is not necessary.
Originally, it is "Require local" and it is not modifiable by Wampserver itself.

> By "offset" I mean, that project-b has the path to project-a AND project-c has the path to project-b
> and so on - all the way down.
This caught my eye - no one is immune to an error. To be sure, I recreated a folder and ServerName structure similar to yours, but I have no error or offset in add_vhost.php
ServerName : www.project-a.local - Directory : e:/wamp64/www/projects/project-a/htmldocs
ServerName : www.alias1-project-a.local - Directory : e:/wamp64/www/projects/project-a/htmldocs
ServerName : www.alias2-project-a.local - Directory : e:/wamp64/www/projects/project-a/htmldocs
ServerName : www.project-b.local - Directory : e:/wamp64/www/projects/project-b/htmldocs
ServerName : www.project-c.local - Directory : e:/wamp64/www/projects/project-c/htmldocs
ServerName : www.project-d.local - Directory : e:/wamp64/www/projects/project-d/htmldocs

What is your version of Wampserver ?

------------------------------------------------------------------------------------------------------------
Wampserver 3.2.8 32 bit - Apache 2.4.52 - PHP 8.1.2…5.6.40 - MySQL 5.7.37 - MariaDB 10.5.13/10.6.5
Wampserver 3.2.8 64 bit - Apache 2.4.52 - PHP 8.1.2…5.6.40 - MySQL 5.7.37/8.0.28 - MariaDB 10.5.13/10.6.5
PhPMyadmin 5.1.2 - MysqlDumper 1.24.5
on W10 and W7 Pro 64 bit
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons
« Ce n'est pas parce qu'ils sont nombreux à avoir tort, qu'ils ont forcément raison. Coluche »
« It's not because they are many to be wrong, they are necessarily right. Coluche »



Edited 1 time(s). Last edit at 12/16/2021 01:23PM by Otomatic.

Options: ReplyQuote
Re: add_vhost confuses project-paths
Posted by: martin__ (---.pitcom.net)
Date: December 16, 2021 04:21PM

Sorry, I forgot to mention:
My server is wamp 3.2.5.
Apache 2.4.46c
PHP 7.4

I will update to the latest wamp-version next week. Maybe that will already fix the problem. I'll keep you posted...

Options: ReplyQuote


Sorry, only registered users may post in this forum.