Upgrading Apache HTTP Server to 2.4

 

Created on: 9/5/19
Last update: 9/9/19

Download

Download:

wget http://mirrors.gigenet.com/apache//httpd/httpd-2.4.41.tar.gz
tar -xvf httpd-2.4.41.tar.gz
cd httpd-2.4.41

Compile and install:

./configure --prefix=/usr/local/apache24
make
make install

Copy the old configure files to new location, then load following modules to save troubles:

LoadModule unixd_module modules/mod_unixd.so
LoadModule access_compat_module modules/mod_access_compat.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule mime_module modules/mod_mime.so
LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule alias_module modules/mod_alias.so
LoadModule slotmem_shm_module modules/mod_slotmem_shm.so

Test:

./bin/apachectl -t

Installation issues

“APR not found” issue

./configure
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
configure:
configure: Configuring Apache Portable Runtime library...
configure:
checking for APR... no
configure: error: APR not found.  Please read the documentation.

Solution:

sudo apt-get install libapr1-dev libaprutil1-dev

pcre-config issue

checking for pcre-config... false
configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/

Solution:

sudo apt-get install libpcre3-dev

Upgrading issues

Common issues while upgrading Apache from 2.2 to 2.4 are summarized at: https://httpd.apache.org/docs/current/upgrading.html.

Mutex issue

AH00548: NameVirtualHost has no effect and will be removed in the next release /usr/local/apache24/conf/extra/httpd-vhosts.conf:20 AH00526: Syntax error on line 72 of /usr/local/apache24/conf/extra/httpd-ssl.conf: Invalid Mutex directory in argument file:/usr/local/apache24/logs/ssl_mutex

Solution: replace SSLMutex with Mutex default 1.

Options issue

AH00526: Syntax error on line 37 of /usr/local/httpd/conf/extra/httpd-vhosts.conf: Either all Options must start with + or -, or no Option may.

Solution: mark the option with + like Options -Indexes +FollowSymLinks 2.

DefaultType issue

AH00117: Ignoring deprecated use of DefaultType in line 59 of /etc/httpd/conf/httpd.conf.

Solution: comment “DefaultType text/plain” 3.

Invalid command ‘UserDir’

Solution:

LoadModule userdir_module modules/mod_userdir.so