我们转向使用 Puppet 进行管理。使用 apache 模块(来自 Puppet)。
试图找出使 puppet 产生如下内容的语法:
<Directory "/data/websites/mysite">
ExpiresActive On
ExpiresDefault "access plus 0 seconds"
ExpiresByType text/javascript "access plus 12 hours"
ExpiresByType application/x-javascript "access plus 12 hours"
ExpiresByType text/css "access plus 12 hours"
ExpiresByType image/gif "access plus 12 hours"
ExpiresByType image/jpeg "access plus 12 hours"
ExpiresByType application/x-shockwave-flash "access plus 12 hours"
</Directory>
我试过这个:
apache::vhost { 'mysite':
servername => 'mysite.com',
vhost_name => $::ipaddress,
port => '80',
docroot => $docroot,
directories => [
{
path => '/var/www/mysite,
provider => 'directory',
options => ['-Indexes','FollowSymLinks'],
expires_active => 'On',
expires_default => 'access plus 0 seconds',
expires_by_type => [
{'text/javascript' => 'access plus 12 hours' },
{'application/x-javascript' => 'access plus 12 hours' },
{'text/css' => 'access plus 12 hours' },
{'image/gif' => 'access plus 12 hours' },
{'image/jpeg' => 'access plus 12 hours' },
{'application/x-shockwave-flash' => 'access plus 12 hours' },
],
},
],
}
这将创建这不是我想要的:
<Directory "/var/www/mysite">
Options -Indexes FollowSymLinks
AllowOverride None
Require all granted
ExpiresActive On
ExpiresDefault access plus 0 seconds
ExpiresByType {"text/javascript"=>"access plus 12 hours"}
ExpiresByType {"application/x-javascript"=>"access plus 12 hours"}
ExpiresByType {"text/css"=>"access plus 12 hours"}
ExpiresByType {"image/gif"=>"access plus 12 hours"}
ExpiresByType {"image/jpeg"=>"access plus 12 hours"}
ExpiresByType {"application/x-shockwave-flash"=>"access plus 12 hours"}
</Directory>
ExpiresDefault 和 ExpiresByType 不起作用。其余的对我来说看起来不错。