httpd-vhosts.conf file requires website to be default to access over web. Fix?

Started by phytotech, October 20, 2022, 10:25:58 AM

Previous topic - Next topic


First time posting.
Moving MantisBT (bug tracker) from older Windows server which used IIS to newer (Windows 2016 server) using WAMP installation for the Apache 2.4.51, MySQL, PHP 7.4.56.

I ended up deleting my first install and reinstalling.
One problem I found was when setting the httpd-vhosts.conf (auto created by WAMP installer and MantisBT), the first or default server was LocalHost and the second was mantisbt as expected. On the first installation (later deleted) I could access the MantisBT site over the web, but after reinstalling, the same httpd-vhosts.conf file used gave the "forbidden. you do not have persmission to access this resource" error. The mantisbt server had what I understood to be the Required All granted clause in the setup. Now, if I made the mantisbt server the first or default server, everything worked fine, i.e. I could access the Mantis site over the web. The problem is that localhost should be the default server, not mantisbt.

So, can anyone tell me what is going on here and how I can make localhost the default and mantisbt still accessible via the web?

Here is the httpd-vhosts.conf file contents as of now. I understand that the order should be reversed so localhost is first, but how to do that and have access to mantisbt?

Thank you,

# Virtual Hosts

# for the life of me, I could not make this vhosts.conf work to allow access via the web/ without making mantisbt first
# typically, localhost is defined first and thus becomes the default.
# in my previous install defining localhost then mantisbt worked fine (it was the madExcept bug attachments that I had trouble with)
<VirtualHost *:80>
   ServerName mantisbt
   ServerAlias mantisbt
   DocumentRoot "c:/wamp64/www/mantisbt"
   <Directory  "c:/wamp64/www/mantisbt/">
      Options +Indexes +Includes +FollowSymLinks +MultiViews
      AllowOverride All
      Require all granted

<VirtualHost *:80>
  ServerName localhost
  ServerAlias localhost
  DocumentRoot "${INSTALL_DIR}/www"
  <Directory "${INSTALL_DIR}/www/">
    Options +Indexes +Includes +FollowSymLinks +MultiViews
    AllowOverride All
    Require local


Hi, sorry for the delay. I'm not getting notification in email like I should be.

This is hard to explain, so much so that the Apache docs have been reworded at least three times and it still makes no sense.

So let me ask you this, what is the ServerName and DocumentRoot set in httpd.conf?


As soon as you add a vhost the "host" from httpd.conf disappears. So you have to add a vhost as the default host.

<VirtualHost _default_:80>
DocumentRoot "C:/apache24/htdocs"

<Directory "C:/apache24/htdocs">
Options Indexes FollowSymLinks
AllowOverride All
Require local

CustomLog "C:\nul" common
# CustomLog "logs/localhost.json" logstash_json
<IfModule fcgid_module>
FcgidInitialEnv 中國人 test_UTF8
FcgidInitialEnv test2 中國人
FcgidInitialEnv PHPRC "${PHP81RC}"
FcgidInitialEnv PATH "${PHP81RC};C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;"
FcgidInitialEnv SystemRoot "C:\\Windows"
FcgidInitialEnv SystemDrive "C:"
FcgidInitialEnv TEMP "C:\\WINDOWS\\TEMP"
FcgidInitialEnv TMP "C:\\WINDOWS\\TEMP"
FcgidInitialEnv windir "C:\\WINDOWS"
FcgidPassHeader Authorization
<Files ~ "\.php$">
Options Indexes FollowSymLinks ExecCGI
AddHandler fcgid-script .php
FcgidWrapper "C:/php81/php-cgi.exe" .php