[英]apache's httpd.conf DocumentRoot -> removable media
I'm setting up a custom portable version of Apache on Windows. 我正在Windows上设置Apache的自定义可移植版本。 A XAMPP built from scratch. 从头开始构建的XAMPP。 So it is portable. 因此是便携式的。 When httpd is started, one of the VirtualHost folders may not be available at that moment (removable device) 启动httpd时,此时VirtualHost文件夹之一可能不可用(可移动设备)
<VirtualHost 127.0.0.1:8081>
ServerName myserver
DocumentRoot "F:/PROJECT1"
</VirtualHost>
So httpd won't start because that DocumentRoot is missing: 所以httpd不会启动,因为缺少DocumentRoot:
DocumentRoot must be a directory
Is there a way to ignore the missing directory (which will be later available)? 有没有办法忽略丢失的目录(以后可用)?
I had the same situation and I wrote own bat file to run server (Apache). 我有同样的情况,我写了自己的bat文件来运行服务器(Apache)。 I didn`t found better solution. 我没有找到更好的解决方案。
This code defines some variable - Project1. 这段代码定义了一些变量-Project1。
StartServer.bat StartServer.bat
set params=
if exist some_path\project1 (
set params=%params%" -D Project1"
)
"apache_path/bin/httpd.exe%params%"
And when you describes you virtual hosts you can put some logic depends on this variable: 在描述虚拟主机时,您可以根据此变量添加一些逻辑:
<IfDefine Project1>
<VirtualHost 127.0.0.1:8081>
...
</VirtualHost>
</IfDefine>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.