apache - 如何通过 Puppet Manifest 在 Apache 中启用 AllowOverride?

标签 apache puppet manifest

如果您查看 httpd.conf,您可以看到“AllowOverride None”,我想将其更改为“AllowOverride All”,但可以通过下面的 Puppet list 来执行此操作。

我已经尝试使用“目录”进行此操作,但它不起作用。在此示例中将AllowOverride更改为All的正确方法是什么?

httpd.conf

# ************************************
# Vhost template in module puppetlabs-apache
# Managed by Puppet
# ************************************

<VirtualHost *:443>
  ServerName test.example.com
  ## Vhost docroot
  DocumentRoot "/var/www/html"

  ## Directories, there should at least be a declaration for /var/www/html

  <Directory "/var/www/html">
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
  </Directory>

apache.pp

  apache::vhost { 'test.example.com':
    port        => '443',
    docroot     => '/var/www/html',
    ssl         => true,
    ssl_cert    => "${ssl_base}/ssl.crt",
    ssl_key     => "${ssl_base}/ssl.key",
    directories => [
      {
        'path'          => '/var/www/html',
        'options'       => 'Indexes FollowSymLinks',
        'allowoverride' => 'All',
      },
    ],
  }
}

最佳答案

根据给出的示例,您似乎需要使用“allow_override”而不是“allowoverride”或“override”。现在这将创建所需的虚拟主机文件。

apache.pp

apache::vhost { 'test.example.com':
  port        => '443',
  docroot     => '/var/www/html',
  ssl         => true,
  ssl_cert    => "${ssl_base}/ssl.crt",
  ssl_key     => "${ssl_base}/ssl.key",
  directories => [
  {
    'path'          => '/var/www/html',
    'options'       => 'Indexes FollowSymLinks',
    'allow_override' => 'All',
  },
],
}
}

关于apache - 如何通过 Puppet Manifest 在 Apache 中启用 AllowOverride?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44506168/

相关文章:

C# - 我需要 list 文件吗?

google-chrome - 如何访问谷歌浏览器本地资源

apache - 为什么 Apache Web 服务器访问日志的格式不正确?

java - 如何自动搭建开发环境?

arrays - puppet 在循环中添加数组元素

android - Chrome 徽章显示在 'Add To Homescreen' 已安装的 PWA 上(仅安装快捷方式)

java - 如何在apache nutch中将获取的html内容保存到数据库?

css - 如何在 Firefox 中跨域加载字体

android - 将 Apache HttpClient 与 Android SDK 23 结合使用。 NoSuchMethod

linux - 使用 puppet 在启动时运行自定义服务