简体   繁体   English

使用Puppet和Vagrant配置Apache

[英]Configuring Apache with Puppet and Vagrant

I'm using Vagrant and Puppet for the first time in a project and I keep running into an issue. 我在项目中第一次使用Vagrant和Puppet而且我一直遇到问题。

I've used PuPHPet as a starting point, and I have the following snippet in my default.pp manifest: 我使用PuPHPet作为起点,我在default.pp清单中有以下代码段:

class { 'apache': }

apache::dotconf { 'custom':
  content => 'EnableSendfile Off',
}

apache::module { 'rewrite': }

apache::vhost { 'awesome.dev':
  server_name   => 'awesome.dev',
  serveraliases => [
],
  docroot       => '/var/www',
  port          => '80',
  directories => [ { path => '/var/www/', allow => 'from all', allow_override => ['All'] }   ],
  env_variables => [],
  priority      => '1',
}

When I run it, I always get the following error: 当我运行它时,我总是得到以下错误:

warning: Could not retrieve fact fqdn
Invalid parameter directories at /tmp/vagrant-puppet/manifests/default.pp:46 on node precise32
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

cd /tmp/vagrant-puppet/manifests && puppet apply --verbose --modulepath '/etc/puppet/modules:/tmp/vagrant-puppet/modules-0' default.pp --detailed-exitcodes || [ $? -eq 2 ]

Line 46 is the end of the apache::vhost rule. 第46行是apache :: vhost规则的结尾。 I want to set it to allow override using htaccess, but I can't see where I've gone wrong. 我想将它设置为允许使用htaccess覆盖,但我无法看到我出错的地方。 Can anyone see what the issue is? 任何人都可以看到问题是什么?

PuPHPet uses the Example42 Apache Puppet module, see the README file. PuPHPet使用Example42 Apache Puppet模块,请参阅README文件。 This module doesn't have a directories parameter in the vhost resource: 该模块在vhost资源中没有目录参数:

https://github.com/puphpet/puphpet-apache/blob/master/manifests/vhost.pp#L100 https://github.com/puphpet/puphpet-apache/blob/master/manifests/vhost.pp#L100

Only the Puppet Labs Apache module has a directories parameter, but it's a different module: 只有Puppet Labs Apache模块有一个目录参数,但它是一个不同的模块:

https://github.com/puppetlabs/puppetlabs-apache/blob/master/manifests/vhost.pp#L25 https://github.com/puppetlabs/puppetlabs-apache/blob/master/manifests/vhost.pp#L25

You can however use the directory parameter in Example42's module similarly to the example which can be found in the vhost resource: 但是,您可以使用Example42模块中的directory参数,类似于可以在vhost资源中找到的示例:

#  apache::vhost { 'my.other.site':
#    docroot                    => '/path/to/docroot',
#    directory                  => '/path/to',
#    directory_allow_override   => 'All',
#  }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM