如果您查看httpd.conf,您可以看到'AllowOverride None',我想将其更改为'AllowOverride All',但通过下面的傀儡清单执行此操作。
我已经尝试过'directories',但它不起作用。在本例中,将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',
},
],
}
}发布于 2018-04-27 08:04:47
看起来您需要使用"allow_override“而不是"allowoverride”或"override“,正如所给出的示例。这将创建所需的vhost文件。
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',
},
],
}
}发布于 2017-06-16 00:58:06
在puppet文档中,可以使用override:https://forge.puppet.com/puppetlabs/apache#override进行设置
下面是apache模块用来设置AllowOverride值的模板:https://github.com/puppetlabs/puppetlabs-apache/blob/61301b5a8d5fa2bf1e98b1d8532aaf141a27f365/templates/vhost/_directories.erb#L55-L57
您的代码应该如下所示:
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',
'override' => 'All',
},
],
}
}下面是他们如何在一个单元测试中使用覆盖的示例:https://github.com/puppetlabs/puppetlabs-apache/blob/2931d0ebc4a0582e5209e9994ab8ae5c445d87b7/spec/acceptance/vhost_spec.rb#L998-L1015
发布于 2017-06-19 19:51:40
我对httpd.conf文件使用了拼音模板。
在这里,allowoverride的值是基于层次结构和环境从hiera传递的。
如果您的httpd.conf在不同环境中保持不变,您可以通过文件资源方法传递它
https://stackoverflow.com/questions/44506168
复制相似问题