I guess it is time for the big boy. Apache can be one of the most complicated things you install, mostly for the additional languages and modules. Like many, I have my own way of configuring it.
I’ll lay this out up front: I don’t like the FreeBSD layout for Apache. Everything is scattered throughout /usr/local and buried deep in the system. I got used to using the OpenBSD layout during my stint with that OS, and so I continue to use that on FreeBSD. It puts everything in /var/www/ and keeps it nice and clean together.
That said, the binaries and other bits and pieces should remain in /usr/local/.
Building from Scratch
For once we’re not going to install Apache from ports. Why? Because it’s too damn hard to adjust the layout without building a completely custom port. What we can do though is use the ports tree to do a big chunk of the work for us.
Configure your options
Run make config in the port and select the options you want installed. I go with the defaults here usually.
|
1 2 |
[root@shana /]$ cd /usr/ports/www/apache22
[root@shana /usr/ports/www/apache22]$ make config |
Install the dependencies
Now that we’ve selected our options, we can also use it to build and install the dependencies, much the same as we would do if we were installing Apache through ports.
|
1 2 3 4 5 6 7 8 9 10 11 |
[root@shana /usr/ports/www/apache22]$ make depends
# ===> apache-2.2.22_5 depends on file: /usr/local/bin/perl5.12.4 - found
# ===> apache-2.2.22_5 depends on file: /usr/local/bin/perl5.12.4 - found
# ===> apache-2.2.22_5 depends on shared library: expat - found
# ===> apache-2.2.22_5 depends on shared library: apr-1 - found
# ===> apache-2.2.22_5 depends on shared library: pcre - found
# ===> apache-2.2.22_5 depends on shared library: iconv.3 - found
# ===> apache-2.2.22_5 depends on file: /usr/local/bin/perl5.12.4 - found
# ===> apache-2.2.22_5 depends on file: /usr/local/bin/autoconf-2.69 - found
# ===> apache-2.2.22_5 depends on package: libtool>=2.4 - found
# ===> apache-2.2.22_5 depends on file: /usr/local/bin/perl5.12.4 - found |
So that is everything we should need.
Generating the configure command
Now we let the port install get as far as configuring the build, that will generate the configure command that was used, and we can copy that command and use it to build our own setup.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
[root@shana /usr/ports/www/apache22]$ make configure
#
# To enable a module category: WITH_<CATEGORY>_MODULES
# To disable a module category: WITHOUT_<CATEGORY>_MODULES
#
# Per default categories are:
# AUTH AUTHN AUTHZ DAV CACHE MISC
# Categories available:
# AUTH AUTHN AUTHZ CACHE DAV EXPERIMENTAL LDAP MISC PROXY SSL SUEXEC THREADS
#
# To see all available knobs, type make show-options
# To see all modules in different categories, type make show-categories
# You can check your modules configuration by using make show-modules
#
# ===> Found saved configuration for apache-2.2.22_5
# ===> Extracting for apache-2.2.22_5
# <snip>
# config.status: creating include/ap_config_auto.h
# config.status: executing default commands |
Setting up our own build environment
Now we’ve had our fun with ports it is time to build our own copy of Apache. I do my compilation in a directory called /archive/compile, but you can do it anywhere you like.
READ MORE »