0

OK, I've figured this out for Apache 2.4 and there are several others like this on Google so I've tried the other solutions and still cannot get at least the main working Drupal site into its virtual host. So the first grouping shows the working httpd.conf with the parts that would be changed for the virtual host. Since there will be only one other virtual host, I left the configure file for vhosts alone and opted for the simpler approach of keeping it in this single httpd.conf file.

ServerRoot "C:/Program Files (x86)/Apache Software Foundation/Apache2.2"
Listen 80
DocumentRoot "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs"
<Directory />
    Options FollowSymLinks
    AllowOverride All
    Order deny,allow
    Deny from all
</Directory>

<Directory "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs">
    Options FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

 I don't know why this was left in as there is no "Drupal" folder in /htdocs. This is left here for completeness but is removed in my broken config file below.

<Directory "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/Drupal">
    Options FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

Of course, I must move the "main" site into its own virtual host declaration and modify as needed. Note that the permissions in Windows must be OK because the above configuration works for this directory. Why does it not seem to work within its vhost block?

This is what I'm trying to get to work based on the Apache docs and the working example above. The main issue is to get the "default" site up and running.

ServerRoot "C:/Program Files (x86)/Apache Software Foundation/Apache2.2"
Listen 80
DocumentRoot "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs"
<Directory />
    Order deny,allow
    Deny from all
    Options None
    AllowOverride none
</Directory>
NameVirtualHost *:80

<VirtualHost *:80>
  DocumentRoot "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs"
  ServerName myshcool.edu
  <Directory "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs">
    Options Indexes FollowSymLinks Includes
    AllowOverride All
    Order allow,deny
    #Order deny,allow
    Allow from all
  </Directory>
</VirtualHost>

<VirtualHost *:80>
  DocumentRoot "C:/independent/"
  ServerName bob.myschool.edu
  <Directory "C:/independent/">
    Options FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
  </Directory>
</VirtualHost>

I've looked at this for several hours and tried different things I've found on Google and server fault. Here is a representative message from the Error log:

client denied by server configuration: C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/

Help me see what I'm overlooking, thx, sam

2
  • Are you sure the vhost config takes precedence over global deny all config? at line 6 you have Deny from all
    – user993553
    Aug 19, 2016 at 9:11
  • Yes, you are right. And also for Drupal it's important to AllowOveride. So my followup question is that for Apache it seems I must set up a default that locks out everything but the virtual hosts are what open up the minimum required on a per host level. What did I not understand?
    – sam452
    Aug 19, 2016 at 13:39

1 Answer 1

1

Can you access your 'bob.myschool.edu' site? I think you might want to swap Order to Order deny,allow. Last one wins, and deny denies all by default. see http://docstore.mik.ua/orelly/linux/apache/ch05_06.htm and http://httpd.apache.org/docs/2.2/mod/mod_authz_host.html#allow so in the global config you want allow deny, and opposite in the vhosts config.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.