简体   繁体   中英

Enable apache2 in prefork mode using Chef

I' trying to install apache2 and php in a Vagrant box (Ubuntu 14.04) using Chef Solo. 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.

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.

Is there a way to do so?

It is possible to set mpm in vagrant file

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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