From 749c528b381e13ab3a61e3ddf1c9679e69012e91 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Thu, 23 Jul 2020 20:49:13 +0100 Subject: [PATCH] Use a separate FPM pool for each wordpress site --- cookbooks/wordpress/recipes/default.rb | 2 +- cookbooks/wordpress/resources/site.rb | 7 +++++++ cookbooks/wordpress/templates/default/apache.erb | 7 ++++--- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/cookbooks/wordpress/recipes/default.rb b/cookbooks/wordpress/recipes/default.rb index 800d3c600..823bf5201 100644 --- a/cookbooks/wordpress/recipes/default.rb +++ b/cookbooks/wordpress/recipes/default.rb @@ -22,7 +22,7 @@ include_recipe "apache" include_recipe "fail2ban" include_recipe "git" include_recipe "mysql" -include_recipe "php::apache" +include_recipe "php::fpm" package %w[ subversion diff --git a/cookbooks/wordpress/resources/site.rb b/cookbooks/wordpress/resources/site.rb index 2105101fc..ee4f12b91 100644 --- a/cookbooks/wordpress/resources/site.rb +++ b/cookbooks/wordpress/resources/site.rb @@ -130,6 +130,13 @@ action :create do domains [new_resource.site] + Array(new_resource.aliases) end + php_fpm new_resource.site do + php_admin_values "open_basedir" => "#{site_directory}/:/usr/share/php/:/tmp/", + "disable_functions" => "exec,shell_exec,system,passthru,popen,proc_open" + php_values "upload_max_filesize" => "70M", + "post_max_size" => "100M" + end + apache_site new_resource.site do cookbook "wordpress" template "apache.erb" diff --git a/cookbooks/wordpress/templates/default/apache.erb b/cookbooks/wordpress/templates/default/apache.erb index 9b6917982..a1187818a 100644 --- a/cookbooks/wordpress/templates/default/apache.erb +++ b/cookbooks/wordpress/templates/default/apache.erb @@ -42,9 +42,6 @@ <% end -%> - ProxyFCGISetEnvIf "true" PHP_ADMIN_VALUE "open_basedir=<%= @directory %>/:/usr/share/php/:/tmp/\ndisable_functions=exec,shell_exec,system,passthru,popen" - ProxyFCGISetEnvIf "true" PHP_VALUE "upload_max_filesize=70M\npost_max_size=100M" - > RewriteEngine on @@ -62,6 +59,10 @@ AllowOverride AuthConfig Require all granted + + + SetHandler "proxy:unix:/run/php/<%= @name %>.sock|fcgi://127.0.0.1" + /wp-config.php> -- 2.39.5