Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compiling Apache web server with dynamic module support

I have just compiled Apache 2.2.17 on a fresh install of Ubuntu 10.04.2. It's a learning exercise to discover what actually goes on when you compile something rather than just using apt-get hence the avoidance of using apt-get in favour of compiling the thing myself.

I ran:

sudo ./configure --prefix=/etc/apache --enable-module=so --enable-rule=SHARED_CORE --enable-shared=max --enable-ssl=shared --enable-rewrite=shared

followed by the obligatory:

sudo make && sudo make install

All seemed to go well (Apache starts up no problems) except that in the Apache modules directory where I would have expected to see mod_rewrite.so and mod_ssl.so, instead I see:

#cd /etc/apache/modules
#ls -l
mod_rewrite.a
mod_rewrite.la
mod_ssl.a
mod_ssl.la

How can I turn these into .so files so I can link them with LoadModule in the Apache config?

Thanks in advance.

like image 628
Julius Avatar asked Oct 21 '25 18:10

Julius


2 Answers

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.

like image 107
Lekensteyn Avatar answered Oct 23 '25 07:10

Lekensteyn


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"?

http://httpd.apache.org/docs/2.2/programs/configure.html

like image 34
Vladislav Rastrusny Avatar answered Oct 23 '25 09:10

Vladislav Rastrusny



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!