2014-09-10 154 views
0

使用https://community.opscode.com/cookbooks/httpd/versions/0.1.5厨师在httpd配方中设置DocumentRoot

有谁知道如何设置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中,但我不知道到底如何设置文档根。

回答

2

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

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

<VirtualHost *:81> 
    ServerAdmin [email protected] 

    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>