A new file was created on Z: for the sole purpose of having a designated file 
for Apache to seek.
The file is  called Z:\files\development\ApacheSmokeSignal.txt.

Here is what httpd-vhosts.conf looks like now:
<IfFile "Z:/files/development/ApacheSmokeSignal.txt">
<VirtualHost *:8080>
 DocumentRoot "Z:/files/xampp/htdocs"
 <Directory "Z:/files/xampp/htdocs">
  Options Indexes
  Require all granted
 </Directory>
</VirtualHost>
</IfFile>

With this update in place, Apache starts fine when Z: is attached to the PC.  
However, when Z: is not attached to the PC Apache does not start and these 
lines appear in the XAMPP Control Panel console:
9:30:24 PM  [Apache]  Attempting to start Apache app...
9:30:24 PM  [Apache]  Status change detected: running
9:30:26 PM  [Apache]  Status change detected: stopped
9:30:26 PM  [Apache]  Error: Apache shutdown unexpectedly.
9:30:26 PM  [Apache]  This may be due to a blocked port, missing dependencies,
9:30:26 PM  [Apache]  improper privileges, a crash, or a shutdown by another 
method.
9:30:26 PM  [Apache]  Press the Logs button to view error logs and check
9:30:26 PM  [Apache]  the Windows Event Viewer for more clues
9:30:26 PM  [Apache]  If you need more help, copy and post this
9:30:26 PM  [Apache]  entire log window on the forums

There are no entries in error.log with a Wed Aug 21 21:30 or later timestamp.

Is the syntax incorrect?  Note that Apache is installed in this location on the 
PC in question: C:\xampp\apache.

________________________________
From: Eric Covener <cove...@gmail.com>
Sent: Wednesday, August 21, 2019 7:27 PM
To: users@httpd.apache.org <users@httpd.apache.org>
Subject: Re: [users@httpd] conditionally create a Virtual Host?

On Wed, Aug 21, 2019 at 8:21 PM Heather Lotz <kno...@hotmail.com> wrote:
>
> Greetings,
>
> In my development environment on a Windows 10 PC I have added the following 
> to Apache's configuration files -
>
> To httpd.conf:
> Listen 8080
>
> To httpd-vhosts.conf:
> <VirtualHost *:8080>
>     DocumentRoot "Z:/files/xampp/htdocs"
> <Directory "Z:/files/xampp/htdocs">
>  Options Indexes
>  Require all granted
> </Directory>
> </VirtualHost>
>
> Note that Z: is mapped to an external storage device.
>
> With this setup, Apache successfully accesses C: on port 80 and Z: on port 
> 8080.  However, if the external storage device is not attached to the 
> computer, Apache will not start.  Is there a way to check if Z: is present, 
> and only create the virtual host if that device is plugged in so that Apache 
> always starts?  If so, how can this be achieved?

Try <IfFile> https://httpd.apache.org/docs/2.4/mod/core.html#iffile

--
Eric Covener
cove...@gmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org

Reply via email to