这适用于共享配置文件,如果存在,则应包含另一个文件,但仍然可以.如果我做
Include foo.conf
Run Code Online (Sandbox Code Playgroud)
并且foo.conf不存在,apache会抱怨:
could not open document config file /etc/httpd/conf/foo.conf
Run Code Online (Sandbox Code Playgroud)
Rus*_*vis 57
我提出了一个聪明的解决方案,尽管可能有更好的方法.将其中一个字符放在括号中,以便Apache将其视为glob模式,允许匹配零文件而不会导致错误.例如:
Include foo.con[f]
Run Code Online (Sandbox Code Playgroud)
use*_*437 41
根据http://httpd.apache.org/docs/2.4/mod/core.html#include,您可以使用"IncludeOptional":
或者,如果缺少文件或目录,将忽略以下命令:
IncludeOptional conf/vhosts/*/*.conf
小智 5
IncludeOptional foo.conf
Run Code Online (Sandbox Code Playgroud)
Apache httpd版本2.3.6及更高版本
https://httpd.apache.org/docs/2.4/mod/core.html#includeoptional
| 归档时间: |
|
| 查看次数: |
44867 次 |
| 最近记录: |