1

I have Apache24. PHP 8.4.15, and MySQL 9.5.0 on Windows.

Running phpinfo(); in index.php located in C:\Apache24\htdocs works when "localhost" is entered in the address bar of a browser. I currently have 3 dev sites in remote folders. I believe what I need to do is create Aliases inside httpd.conf to point to the three sites.

The few Windows examples I found gave different solutions which either seemed to do nothing (Apache restarted but opening my remote index.html file opened in file:///C:/John's%20Stuff/Hobbies/Developing/Web%20Development/GCHS/index.html. One conf modification, upon restart, Apache threw the errors:

AH00112: Warning: DocumentRoot [C:/Apache24-64/docs/dummy-host.example.com] does not exist

AH00112: Warning: DocumentRoot [C:/Apache24-64/docs/dummy-host2.example.com] does not exist

AH00548: NameVirtualHost has no effect and will be removed in the next release C:/Apache24/conf/httpd.conf:532

AH00112: Warning: DocumentRoot [C:/John's Stuff/Hobbies/Developing/Web/GCHS] does not exist

AH00112: Warning: DocumentRoot [C:/Apache/htdocs] does not exist

With these mods, the config file was modified:

 ServerName localhost <Directory /> AllowOverride none Require all denied </Directory> Include conf/extra/httpd-vhosts.conf <Directory "C:/John's Stuff/Hobbies/Developing/Web Development "> Order Deny,Allow Allow from all </Directory> NameVirtualHost 127.0.0.1 <VirtualHost 127.0.0.1> DocumentRoot "C:/John's Stuff/Hobbies/Developing/Web/GCHS" ServerName imheuristic.local </VirtualHost> <VirtualHost 127.0.0.1> DocumentRoot C:/Apache/htdocs ServerName localhost </VirtualHost> 

I obviously don't know what I am doing. Can someone set me straight?

Thank you for the reply, Luuk:

C:\Apache24\bin>httpd.exe -t -D DUMP_VHOSTS AH00112: Warning: DocumentRoot [C:/Apache24-64/docs/dummy-host.example.com] does not exist AH00112: Warning: DocumentRoot [C:/Apache24-64/docs/dummy-host2.example.com] does not exist AH00548: NameVirtualHost has no effect and will be removed in the next release C:/Apache24/conf/httpd.conf:532 AH00112: Warning: DocumentRoot [C:/John's Stuff/Hobbies/Developing/Web/GCHS] does not exist AH00112: Warning: DocumentRoot [C:/Apache/htdocs] does not exist VirtualHost configuration: 127.0.0.1:* is a NameVirtualHost default server imheuristic.local (C:/Apache24/conf/httpd.conf:533) port * namevhost imheuristic.local (C:/Apache24/conf/httpd.conf:533) port * namevhost localhost (C:/Apache24/conf/httpd.conf:538) *:80 is a NameVirtualHost default server dummy-host.example.com (C:/Apache24/conf/extra/httpd-vhosts.conf:23) port 80 namevhost dummy-host.example.com (C:/Apache24/conf/extra/httpd-vhosts.conf:23) alias www.dummy-host.example.com port 80 namevhost dummy-host2.example.com (C:/Apache24/conf/extra/httpd-vhosts.conf:32) 

And

C:\Apache24\bin>httpd -t AH00112: Warning: DocumentRoot [C:/Apache24-64/docs/dummy-host.example.com] does not exist AH00112: Warning: DocumentRoot [C:/Apache24-64/docs/dummy-host2.example.com] does not exist AH00548: NameVirtualHost has no effect and will be removed in the next release C:/Apache24/conf/httpd.conf:532 AH00112: Warning: DocumentRoot [C:/John's Stuff/Hobbies/Developing/Web/GCHS] does not exist AH00112: Warning: DocumentRoot [C:/Apache/htdocs] does not exist Syntax OK 
New contributor
Damn Yankee is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
8
  • Cross posted at webmaster Commented Dec 11 at 21:17
  • Please share the output of: httpd.exe -t -D DUMP_VHOSTS (use edit to add it to your question) (more info: Is there a command to display apache vhost config?) Commented 2 days ago
  • Also do a httpd -t, which produces a syntax check for config files (see: httpd -?) Commented 2 days ago
  • Now it is unclear what is unclear about this warning: "AH00112: Warning: DocumentRoot [C:/Apache24-64/docs/dummy-host.example.com] does not exist" Commented 2 days ago
  • The only weird/incorrect thing might be the space at the end of the directory name in <Directory "C:/John's Stuff/Hobbies/Developing/Web Development "> (the name should be between the double quotes, and it ends with a space) Commented 2 days ago

1 Answer 1

0

A configuration like this is not OK, as you found out:

<VirtualHost 127.0.0.1> DocumentRoot "C:/John's Stuff/Hobbies/Developing/Web/GCHS" ServerName imheuristic.local </VirtualHost> <VirtualHost 127.0.0.1> DocumentRoot C:/Apache/htdocs ServerName localhost </VirtualHost> 

This is because your browser will show all trafic frm the first VirtualHost to this first configuration.

When you change it to something like this:

<VirtualHost imheuristic.local> DocumentRoot "C:/John's Stuff/Hobbies/Developing/Web/GCHS" ServerName imheuristic.local </VirtualHost> <VirtualHost localhost> DocumentRoot C:/Apache/htdocs ServerName localhost </VirtualHost> 

Then visiting http://localhost should show the website from C:/Apache/htdocs

And visiting http://imheuristic.local should show the website from C:/John's Stuff/Hobbies/Developing/Web/GCHS

But, one thing is needed before that. Windows should know where imheuristic.local is.

To make Windows find this system, you need to edit the windows file located in C:\Windows\System32\Drivers\etc\hosts, and add a line like this:

127.0.0.1 imheuristic.local 

After this you two websites should work, but probably you will get an "access denied".

This is because of the confiduration:

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

Which makes the access denied to everything on your system.

I think you can safely delete those four lines when you are the only user on your computer. For safety, and when multiple users are using this computer, you might need to do some more research, but I am limiting this answer to the configuration of the VirtualHost.

4
  • Thank you Luuk. One more thing, please. I believe that apache24\conff\extra\httpd-vhosts.conf must be modded as well as I now think that is where the mysterious "dummy-host.example.com" comes from. But I do not understand any of the commands/values. Thoughts? Commented yesterday
  • The "dummy-host.example.com" is just an example, which is in the default extra\httpd-vhosts.conf after installing apache2.4. please read this complete page: Running several name-based web sites on a single IP address, and take extra care to understand the Note: at the end. Commented yesterday
  • I reread that doc. If I am right, it is about configuring Apache as a server to the outside (Internet). I want to use it to develop dynamic sites (PHP & MySQL) locally, but my files are not located in htdocs - they are in other folders. Is VirtualHost the correct way to do this? Commented yesterday
  • "Configuring for the internet" is something completely different than "develop locally". First you develop/test locally, then you can copy the site that tests OK to the internet. Configuration, like PATHs are almost always different when published on the internet. Commented yesterday

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.