厨师在httpd食谱中设置DocumentRoot

时间:2014-09-10 17:56:17

标签: apache chef cookbook

使用https://community.opscode.com/cookbooks/httpd/versions/0.1.5

有谁知道如何设置DocumentRoot?财产?

我正在使用

httpd_service "default" do
  listen_ports ['81']
  action :create
end

产生

ServerName centos65x64
ServerRoot /etc/httpd
PidFile /var/run/httpd/httpd.pid
User apache
Group apache
Timeout 400
ErrorLog /var/log/httpd/error_log
LogLevel warn
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5
DefaultType None
HostnameLookups off

Listen 0.0.0.0:81
Include conf.d/*.conf
Include conf.d/*.load

在httpd.conf中,但我不确定如何设置DocRoot。

1 个答案:

答案 0 :(得分:2)

cookbook中包含的httpd_config资源将httpd配置文件从模板部署到httpd实例的config目录,以便在httpd运行时包含。您可以从这些模板配置VirtualHosts或主服务器,而不是设置cookbook选择的节点属性并为您生成虚拟主机。

这意味着您可以为VirtualHost配置创建Erubis模板。有一个这样的配置in the cookbook tests ...

<VirtualHost *:81>
    ServerAdmin mike@patel.net

    DocumentRoot /var/www
    CustomLog /var/log/apache/mike-patel-access.log combined

    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>

    <Directory /var/www/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all
    </Directory>

    LogLevel warn
</VirtualHost>