Compiling Apache web server with dynamic module support
You should not run everything as root. ./configure
and make
will work fine without root permissions, make install
requires root permissions for writing to directories like /etc
and /usr/bin
.
/etc
is not suitable for executables, let alone a full Apache installation. If you want to put your configuration files in /etc/apache
, use the --sysconfdir=/etc/apache
. The correct place to install a custom-build Apache is /usr/local
.
To enable shared modules, you have to pass the --enable-so
option, the modules which should be compiled as shared should be added to --enable-mods-shared
.
The correct configure line for Apache + mod_ssl (shared module) + mod_rewrite (shared module) is, installed in /usr/local/apache
with configuration files in /etc/apache
:
./configure --prefix=/usr/local/apache --sysconfdir=/etc/apache --enable-so \ --enable-rewrite --enable-ssl --enable-mods-shared='rewrite ssl'
After successful configuring Apache HTTPd, run make
followed by sudo make install
.
More information about the configure options can be found at the Apache HTTPd documentation.
I have suffered the same problem: tried to compile apache 2.2.x with all (possible) modules compiled as dynamic modules and not statically.
Even though I have used the configure option (--enable-mods-shared="list,of,modules") the modules were compiled as static and not as shared. And worse, some errors appeared when trying to "httpd -M" or "apachectl configtest" related to "*.so" files not being found even though they are listed in the httpd.conf just installed (gmake install).
I have investigated the FreeBSD ports system and found that their port indeed create an apache2.2.x with all shared modules, as I wanted. I have found that it is an issue with the "configure" options.
To solve, I have done exactly as the ports, when configuring I have first "disabled" all modules (hard to find the complete list of them but got it) with many "--disable-MODULE" entries in configure. Here is my working example:
"./configure" "--enable-layout=FreeBSD" "--with-perl=/usr/local/bin/perl5.12.4" "--with-expat=/usr/local" "--with-iconv=/usr/local" "--with-pcre=/usr/local" "--disable-authn-file" "--disable-authn-default" "--disable-authz-host" "--disable-authz-groupfile" "--disable-authz-user" "--disable-authz-default" "--disable-auth-basic" "--disable-charset-lite" "--disable-include" "--disable-log-config" "--disable-env" "--disable-setenvif" "--disable-mime" "--disable-status" "--disable-autoindex" "--disable-asis" "--disable-cgid" "--disable-cgi" "--disable-negotiation" "--disable-dir" "--disable-imagemap" "--disable-actions" "--disable-userdir" "--disable-alias" "--disable-filter" "--disable-substitute" "--disable-proxy" "--disable-proxy-connect" "--disable-proxy-ftp" "--disable-proxy-http" "--disable-proxy-ajp" "--disable-proxy-balancer" "--disable-proxy-scgi" "--disable-reqtimeout" "--enable-so" "--enable-mods-shared=auth_basic auth_digest authn_file authn_dbm authn_anon authn_default authn_alias authz_host authz_groupfile authz_user authz_dbm authz_owner authz_default cache disk_cache file_cache dav dav_fs actions alias asis autoindex cern_meta cgi charset_lite deflate dir dumpio env expires headers imagemap include info log_config logio mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias filter version reqtimeout ssl" "--with-dbm=sdbm" "--with-ssl=/usr" "--disable-ipv6" "--with-devrandom" "--with-mpm=worker" "--prefix=/usr/local" "--mandir=/usr/local/man" "--infodir=/usr/local/info/"
This way, all the apache2.2.x modules were built as dynamic instead of static.If you forget to "--disable-XXX" them and only try to "--enable-XXX" or even "--enable-mods-shared=XXX,YYY,ZZZ", it does not work. You have to disable them before setting the "--enable-mods-shared" configure option.
Try this
sudo ./configure --prefix=/etc/apache --enable-so --enable-shared=max --enable-rewrite -enable-mods-shared="all ssl ldap cache proxy authn_alias mem_cache file_cache authnz_ldap charset_lite dav_lock disk_cache"
Caveat: --enable-mods-shared=all does not actually build all modules.
--enable-shared=max is invalid. I think you wanted to use "most"?