]> git.openstreetmap.org Git - chef.git/commitdiff
Use a separate FPM pool for each wordpress site
authorTom Hughes <tom@compton.nu>
Thu, 23 Jul 2020 19:49:13 +0000 (20:49 +0100)
committerTom Hughes <tom@compton.nu>
Thu, 23 Jul 2020 19:49:13 +0000 (20:49 +0100)
cookbooks/wordpress/recipes/default.rb
cookbooks/wordpress/resources/site.rb
cookbooks/wordpress/templates/default/apache.erb

index 800d3c6004eb6106002854f5acdb9f83e1c3174a..823bf5201b4868cddf4a766b311b885b953741d6 100644 (file)
@@ -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
index 2105101fceb012be291163180a949d14d5921fe8..ee4f12b91614f17d956c9a6e5758b90cfa258d50 100644 (file)
@@ -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"
index 9b691798203ed299d64bb6c7b4d2932864a6b015..a1187818a55d60d3527b6f614af36c9588181f96 100644 (file)
@@ -42,9 +42,6 @@
   </Directory>
 <% 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"
-
   <Directory <%= @directory %>>
     RewriteEngine on
 
     AllowOverride AuthConfig
 
     Require all granted
+
+    <FilesMatch ".+\.ph(ar|p|tml)$">
+      SetHandler "proxy:unix:/run/php/<%= @name %>.sock|fcgi://127.0.0.1"
+    </FilesMatch>
   </Directory>
 
   <Files <%= @directory %>/wp-config.php>