Wampserver 403 on named virtual hosts outside / www

Wampserver tells me that access is denied when trying to make a virtual host outside the c: / wamp / www / directory. I can make one of them in this directory. Even creating a symbolic link to a folder works, but I would prefer not to use symbolic links. Why is this not working?

Here is the code I use at the end of httpd.conf

NameVirtualHost *:80 <VirtualHost *:80> DocumentRoot "c:/wamp/www" ServerName localhost ServerAlias localhost </VirtualHost> <VirtualHost *:80> ServerName local.cascade DocumentRoot c:/wamp/www/cascade/ </VirtualHost> <VirtualHost *:80> ServerName local.md9 ServerAlias local.md9 DocumentRoot "m:/Work/New MD9.ca/site/" </VirtualHost> <Directory "m:/Work/New MD9.ca/site/"> Order Allow,Deny Allow from All </Directory> 

Cascade vh works great.

+11
wampserver virtualhost wamp
Jun 02 2018-12-12T00:
source share
5 answers

I think I should take a closer look at http.conf. It's not so long, mostly comments. That was the unpleasant part.

 # Deny access to the entirety of your server filesystem. You must # explicitly permit access to web content directories in other # <Directory> blocks below. # <Directory /> AllowOverride none Require all denied </Directory> 

I commented on this and now the material works, although I think it is less secure, but it is just a test server.

I thought the <Directory "m:/Work/New MD9.ca/site/"> should have taken care of this, but I don't think so.

+26
Jun 03 2018-12-12T00:
source share

I know that the question is old and you have a job, but I ran into this problem and solved it without removing the Require all denied tag.

You just need to add the Require local tag (or Require all for online access) to the Directory tag. eg.

 <VirtualHost *:80> ServerName local.md9 ServerAlias local.md9 DocumentRoot "m:/Work/New MD9.ca/site/" <Directory "m:/Work/New MD9.ca/site/"> Order Allow,Deny Allow from All Require local </Directory> </VirtualHost> 

You can see the same rule declared in the DocumentRoot directory in httpd.conf

+18
Jan 03 '13 at 10:28
source share

I had the same problem, but I managed to resolve this issue.

However, the accepted answer may not be the best solution, depending on how secure your Apache configuration is.

I think that the solution should mention two things: first, security is not compromised, but the second; Understanding the difference in access control configuration between Apache versions 2.2 and 2.4.

Security is not compromised

Commenting out the suggested lines:

 <Directory /> AllowOverride none Require all denied </Directory> 

Allows you to remove the default default protection that applies to all directories on your machine, as I understand it. Someone else can create a configuration that points to your C:\very\sensitive\information directory and send content from there to the website (which is likely to be a problem for the shared host). Interestingly, the following comment was made on this block:

 # First, we configure the "default" to be a very restrictive set of # features. 

Then under this block:

 # Note that from this point forward you must specifically allow # particular features to be enabled - so if something not working as # you might expect, make sure that you have specifically enabled it # below. 

Everything makes sense to block everything, then conditionally unlock for each directory.

I came up with the following, which indicates the location on my machine where all my sites (served through Apache virtual hosts) will live. This immediately follows the <Directory "d:/wamp/www/"></Directory> block.

 <Directory "d:/wamp/sites/"> Options Indexes FollowSymLinks AllowOverride all Require all granted </Directory> 

Then, in each of your virtual host configurations / aliases, you can set the configuration that applies to this directory.

The difference in access control configuration

Access control settings in later versions of Apache have changed.

Before:

 Order allow,deny Allow from all 

Must be:

 Require all granted 

For more information: http://httpd.apache.org/docs/current/upgrading.html

+5
Oct. 01 '14 at 12:25
source share

The <Directory> must be inside <VirtualHost *:80>

like this:

 <VirtualHost *:80> ServerName local.md9 ServerAlias local.md9 DocumentRoot "m:/Work/New MD9.ca/site/" <Directory "m:/Work/New MD9.ca/site/"> Order Allow,Deny Allow from All </Directory> </VirtualHost> 

also note that for the default external folder www you should use require, not allow

 <Directory /> AllowOverride none Require all denied </Directory> 
+3
Dec 09 '12 at 15:57
source share

If you made all the changes made to .conf and did not work, try the following additional steps:

1) Make sure DocumentRoot and <Directory> location are the same !

2) The double spell check of the "ServerName" domain name in the <VirtualHost> tags, as well as the spell check of the domain is the same in the HOST file (windows \ system32 \ drivers \ etc \ hosts):

Example:

 <VirtualHost *:80> DocumentRoot "D:/vhost_directory/website_directory" ServerName mywebsite.local <Directory "D:/vhost_directory/website_directory"> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory> </VirtualHost> 

3) Check the syntax of the conf files:

 cd \wamp\bin\apache\apache2.4.9\bin httpd -t 

4) Fix the conf files until you get the result:

 Syntax OK 

5) Update the domain name cache (you need to start the console as an administrator):

 net stop dnscache net start dnscache 

6) Restart the Apache service or restart all services on WAMP

+1
Jan 26 '15 at 13:35
source share



All Articles