diff --git a/CHANGELOG.md b/CHANGELOG.md index a4bd9b0d..77e1c01d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ This file is used to list changes made in each version of the nagios cookbook. Standardise files with files in sous-chefs/repo-management +- Add support for el9 based systems +- Centos stream 8 is EOL, switched to Centos stream 9 + ## 12.0.0 - *2024-07-02* - Standardise files with files in sous-chefs/repo-management diff --git a/kitchen.yml b/kitchen.yml index 005055b6..3ab0f12a 100644 --- a/kitchen.yml +++ b/kitchen.yml @@ -17,10 +17,13 @@ verifier: platforms: - name: almalinux-8 - - name: centos-stream-8 + - name: almalinux-9 + - name: centos-stream-9 - name: debian-11 - name: debian-12 + - name: fedora-latest - name: rockylinux-8 + - name: rockylinux-9 - name: ubuntu-20.04 - name: ubuntu-22.04 - name: ubuntu-24.04 diff --git a/recipes/apache.rb b/recipes/apache.rb index 951d0101..667a04b7 100644 --- a/recipes/apache.rb +++ b/recipes/apache.rb @@ -27,7 +27,21 @@ apache2_module 'cgi' apache2_module 'rewrite' -apache2_mod_php 'nagios' +if apache_mod_php_supported? + apache2_mod_php 'nagios' + apache_php_handler = 'application/x-httpd-php' +else + apache2_module 'proxy' + apache2_module 'proxy_fcgi' + apache2_mod_proxy 'proxy' + php_fpm_pool 'nagios' do + user default_apache_user + group default_apache_group + listen_user default_apache_user + listen_group default_apache_group + end + apache_php_handler = "proxy:unix:#{php_fpm_socket}|fcgi://localhost" +end apache2_module 'ssl' if node['nagios']['enable_ssl'] @@ -44,11 +58,10 @@ https: node['nagios']['enable_ssl'], ssl_cert_file: node['nagios']['ssl_cert_file'], ssl_cert_key: node['nagios']['ssl_cert_key'], - apache_log_dir: default_log_dir + apache_log_dir: default_log_dir, + apache_php_handler: apache_php_handler ) - if File.symlink?("#{apache_dir}/sites-enabled/#{node['nagios']['server']['vname']}.conf") - notifies :restart, 'apache2_service[nagios]' - end + notifies :restart, 'apache2_service[nagios]' if File.symlink?("#{apache_dir}/sites-enabled/#{node['nagios']['server']['vname']}.conf") end file "#{apache_dir}/conf.d/#{node['nagios']['server']['vname']}.conf" do @@ -89,7 +102,10 @@ subscribes :restart, 'apache2_install[nagios]' subscribes :reload, 'apache2_module[cgi]' subscribes :reload, 'apache2_module[rewrite]' - subscribes :reload, 'apache2_mod_php[nagios]' + subscribes :reload, 'apache2_mod_php[nagios]' if apache_mod_php_supported? + subscribes :reload, 'apache2_module[proxy]' unless apache_mod_php_supported? + subscribes :reload, 'apache2_module[proxy_fcgi]' unless apache_mod_php_supported? + subscribes :reload, 'apache2_mod_proxy[proxy]' unless apache_mod_php_supported? subscribes :reload, 'apache2_module[ssl]' if node['nagios']['enable_ssl'] end diff --git a/templates/apache2.conf.erb b/templates/apache2.conf.erb index 79e002d7..6970ad2f 100644 --- a/templates/apache2.conf.erb +++ b/templates/apache2.conf.erb @@ -34,7 +34,7 @@ - SetHandler application/x-httpd-php + SetHandler "<%= @apache_php_handler %>" <% if @https -%>