简体   繁体   English

使用Chef在前叉模式下启用apache2

[英]Enable apache2 in prefork mode using Chef

I' trying to install apache2 and php in a Vagrant box (Ubuntu 14.04) using Chef Solo. 我正在尝试使用Chef Solo将apache2和php安装在无业游民的盒子(Ubuntu 14.04)中。 This is my recipe: 这是我的食谱:

include_recipe "apache2"
include_recipe "apache2::mod_rewrite"
include_recipe "apache2::mod_ssl"
include_recipe "apache2::mod_php5"

### some changes due to php5 reqs. ###
#-------------------------------------
apache_module "mpm_event" do
  enable false
end

apache_module "mpm_prefork" do
  enable true
end

service "apache2" do
  action :restart
end

This because apache2 is installed with mpm_event by default, and I need to change it because of php. 这是因为apache2默认情况下是与mpm_event一起安装的,由于php我需要更改它。

For some reasons, this not always works (sometimes, apache2 won't restart due to mpm_event still enabled), so I'm searching a more idiomatic and chef-safe way to install apache2 directly with prefork module rather than event. 由于某些原因,这并不总是可行的(有时,由于仍然启用了mpm_event,apache2不会重新启动),因此我正在寻找一种更加惯用且更安全的方法, 直接使用 prefork模块而不是event安装apache2。

Is there a way to do so? 有办法吗?

It is possible to set mpm in vagrant file 可以在流浪者文件中设置MPM

  config.vm.provision "chef_solo" do |chef|
    chef.json = {
      "apache" => {
        "mpm" => "prefork"
      }
    }
  end

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

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