【问题标题】:Including multiple .txt files into httpd.conf using regex?使用正则表达式将多个 .txt 文件包含到 httpd.conf 中?
【发布时间】:2018-03-10 14:35:03
【问题描述】:

我希望能够在 httpd.conf 中包含多个虚拟主机文件。我知道可以使用以下内容包含一个:

include virtualhost-1.txt

但是,我希望能够导入某个目录中的所有虚拟主机文件,而无需对包含语句进行硬编码。是否有合适的命令/语法?我知道目录并且有一个合适的正则表达式:

^.+-[0-9]+\.txt

【问题讨论】:

    标签: regex apache include httpd.conf


    【解决方案1】:

    Include directive 的语法如下:

    Include file-path|directory-path|wildcard
    

    你可以这样做:

     Include /usr/local/apache2/conf/vhosts/dom1-*.conf
    

    包含目录/usr/local/apache2/conf/vhosts/ 中以dom1- 开头的所有配置。请注意,您可以使用通配符,但不能使用完整的正则表达式。

    【讨论】:

      猜你喜欢
      • 2017-06-24
      • 1970-01-01
      • 2016-11-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多