The Apache Haus Forum

Advanced search  

News:

Welcome to Apache Haus Distribution Forum

Pages: [1]   Go Down

Author Topic: DocumentRoot being overwritten in VirtualHost config  (Read 2985 times)

Waccoon

  • Newbie
  • *
  • Offline Offline
  • Posts: 1
DocumentRoot being overwritten in VirtualHost config
« on: June 01, 2015, 05:07:58 AM »

Hello.  While upgrading from Apache 2.2 to 2.4, I've discovered a problem with the Apache Haus VC9 build of Apache 2.4.12 which does not exist in other Windows binary builds of Apache.  Apparently, Apache Haus is enabling VirtualHosts by default, and this causes the main DocumentRoot declaration to be overwritten in the httpd-vhosts.conf file.

I use a dedicated partition of my SSD to host my DocumentRoot.  Upon installation, I changed my DocumentRoot in the httpd.conf file from "${SRVROOT}/htdocs" to "W:/", and updated the directory permissions for "W:/" accordingly.

The server insisted on defaulting to "${SRVROOT}/htdocs" and kept showing me the default Welcome page.  I eventually found out that the VirtualHosts file is being included at the end of the main config file, resulting in the DocumentRoot being overwritten, as follows:

Code: [Select]
<VirtualHost _default_:80>
DocumentRoot "${SRVROOT}/htdocs"
#ServerName www.example.com:80
</VirtualHost>

Therefore, it is necessary to copy a custom DocumentRoot setting into both config files for it to work.  As I've never used VirtualHosts before, this took me a few hours to figure out.

When searching the Internet for assistance, I discovered that other people having this issue were all using a Windows version of Apache.  I then checked some other Windows builds and found that only the Apache Haus version has this issue.  Either the installation instructions should be updated to take the default VirtualHosts setting into account, or the config files should be updated to avoid the duplicate DocumentRoot declaration.

Thanks!
Logged

Gregg

  • Administrator
  • Member Elite
  • *****
  • Offline Offline
  • Posts: 847
Re: DocumentRoot being overwritten in VirtualHost config
« Reply #1 on: June 01, 2015, 05:32:31 AM »

Ok, what it does however is heads off an even bigger issue I've seen people have more times than I can count which is "Can't get virtual hosts to work."

You do make a good point however. Looking at he readme it could a note that if you only want a single host, comment out the Include httpd-vhosts.conf line. I'll have a look over our current config as well and see where it maybe could use some improvement.

Thanks for bringing this up.
Logged

Gregg

  • Administrator
  • Member Elite
  • *****
  • Offline Offline
  • Posts: 847
Re: DocumentRoot being overwritten in VirtualHost config
« Reply #2 on: June 05, 2015, 05:38:05 AM »

Actually, what I have done is not load httpd-vhosts.conf by default. I had already noted the importance of the first vhost being a partial duplicate of the main host (in 2.4 anyway). I have done same including the note in 2.2 as well so all downloads from 2.2.30 & 2.4.13 on should not have this problem you had, nor the problem I was trying to avoid in the first place.

Again, thanks for reporting this. I wish the others would have reported it here long ago.
Logged
Pages: [1]   Go Up
 

Sitemap 1 2 3 4 5 6 7 8 9 10 11 12 13