Upgrade to Apache 2.4

Hi all,

I have upgraded from Apache 2.2 to Apache 2.4. Now I get problems with SmokePing, Nagios 4 and Cacti. I have read change of access for Apache 2.4. Can anybody see any problem with my httpd.conf? I have no errors when run apachectl restart.

//Jan
Code:
ScriptAlias /smokeping.fcgi /usr/local/smokeping/htdocs/smokeping.fcgi
# ScriptAlias /tr.cgi /usr/local/smokeping/htdocs/tr.cgi
Alias /img /usr/local/smokeping/htdocs/img
<Directory "/usr/local/smokeping/htdocs">
AllowOverride None
# Order allow,deny
# Allow from all
Require all granted
</Directory>


<Directory "/usr/local/www/apache22/data/smokeping">
Options +ExecCGI
AddHandler cgi-script .cgi
</Directory>


<Directory /usr/local/www/nagios>

# Options +Indexes FollowSymLinks +ExecCGI
AllowOverride Indexes AuthConfig FileInfo
# Order allow,deny
# Allow from all
Require all granted
AuthName "Nagios Access"
AuthType Basic
AuthUSerFile /usr/local/etc/nagios/htpasswd.users
Require valid-user

</Directory>


<Directory /usr/local/www/nagios>
# Order deny,allow
# Deny from all
# Allow from 127.0.0.1
Require all granted
php_flag engine on
php_admin_value open_basedir /usr/local/www/nagios/:/var/spool/nagios/
</Directory>

<Directory /usr/local/www/nagios/cgi-bin>
Options ExecCGI
</Directory>

ScriptAlias /nagios/cgi-bin/ /usr/local/www/nagios/cgi-bin/
Alias /nagios/ /usr/local/www/nagios/

<Directory "ScriptAlias /nagios/cgi-bin">
Options +ExecCGI
AddHandler cgi-script .cgi
</Directory>

<Directory /usr/local/share/cacti>
AllowOverride None
# Order Allow,deny
Require all granted
# Allow from all
</Directory>
Alias /cacti /usr/local/share/cacti/
 
You don't actually mention what the issues you are experiencing are so its going to be a bit difficult to offer suggestions on how to resolve them.

As you are using the new style access control directives, you should check that you have included the new module mod_authz_host. Alternatively use the old style Order allow,deny and include mod_access_compat.
 
The most common cause is not setting DirectoryIndex properly and not having a index.html or index.php. Then Apache will use the directory view which is disabled by default for security reasons.
 
Is is possible to have both 2.2 and 2.4 on the same server listening on different ports? I had to restore the install of the 2.2 from a snapshot, the computer is running on VMware.

I don't want to upgrade again to 2.4 with a big bang.
 
I just found a good example for smokeping and 2.4 configuration.

Code:
LoadModule cgi_module libexec/apache24/mod_cgi.so

Alias /smokeping /usr/local/smokeping/htdocs
<Directory /usr/local/smokeping/htdocs>
    Require all granted
    AllowOverride none
    Options Indexes FollowSymLinks ExecCGI
    AddHandler cgi-script .cgi .fcgi
    DirectoryIndex index.html smokeping.fcgi
</Directory>
 
Example of Nagios with 2.4
Code:
Alias /nagios "/usr/local/www/nagios/"
<Directory "/usr/local/www/nagios">

Options +Indexes FollowSymLinks +ExecCGI
AllowOverride Indexes AuthConfig FileInfo
Order allow,deny
Allow from all
AuthName "Nagios Access"
AuthType Basic
AuthUSerFile /usr/local/etc/nagios/htpasswd.users
Require valid-user
</Directory>

ScriptAlias /nagios/cgi-bin/ "/usr/local/www/nagios/cgi-bin/"

<Directory "/usr/local/www/nagios/cgi-bin">
Options +ExecCGI
AllowOverride None
Order allow,deny
Allow from all
AuthName "Nagios Access"
AuthType Basic
AuthUSerFile /usr/local/etc/nagios/htpasswd.users
Require valid-user
</Directory>
 
Does anyone have an example of a Cacti and PHP setup for Apache 2.4 that is working?
Code:
uname -a
FreeBSD netmon 8.4-RELEASE-p14 FreeBSD 8.4-RELEASE-p14 #0: Tue Jul  8 12:02:53 UTC 2014     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  i386
 
It's exactly the same as for 2.2. The only real difference is in the way you define ACLs.
 
SirDice said:
It's exactly the same as for 2.2. The only real difference is in the way you define ACLs.

There is more that needs to be change than the ACL. Smokeping is working now and Cacti with below configuration, but not Nagios version 4. Anybody who has a working Apache 2.4 and Nagios 4 and wants to share it for the httpd.conf?
Code:
<Directory /usr/local/share/cacti>
AllowOverride None
Require all granted
Allow from all
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
DirectoryIndex about.php index.php
# Options Indexes FollowSymLinks ExecCGI
Options Indexes Includes FollowSymLinks
</Directory>

Alias /cacti /usr/local/share/cacti

ScriptAlias /smokeping.fcgi /usr/local/smokeping/htdocs/smokeping.fcgi
# ScriptAlias /tr.cgi /usr/local/smokeping/htdocs/tr.cgi
Alias /img /usr/local/smokeping/htdocs/img
<Directory "/usr/local/smokeping/htdocs">
Require all granted
AllowOverride none
Options Indexes FollowSymLinks ExecCGI
AddHandler cgi-script .cgi .fcgi
DirectoryIndex index.html smokeping.fcgi
</Directory>

<Directory "/usr/local/www/apache24/data/smokeping">
Options +ExecCGI
AddHandler cgi-script .cgi
</Directory>
 
Back
Top