Before plunging into detail about various configuration parameters, itís worth pointing out a few options that adjust the overall configuration process or provide information about the process and about configure itself. Some of these options are unique to Apache 1.3, and others are new in Apache 2 (see Table 3-1).
Table 3-1. Apache 2 configure Script Options
Table 3-1. Apache 2configure Script Options (Continued)
Setting the Default Server Port, User, and Group
A number of the configuration directives that you have to set in httpd.conf can be preset using a corresponding option at build time. In particular, you can set the user and group under which the server runs and the port number to which itíll listen. What makes these different from other values that might seem to be just as importantófor example, the document rootóis that, for varying reasons, it may be particularly useful or even necessary to specify them in advance.
The port is a required setting of Apache 2; the server wonít start without it being explicitly configured. Specifying it at build time will cause Apache to add a corresponding line into httpd.conf. Without it, youíll need to edit httpd.conf, so if you want to create an immediately usable Apache, you must set it here, too. You can change it with the --with-port option, for example:
$ ./configure --with-port=80 ...
In Apache 1.3 the default port number in httpd.conf is set to 80 automatically, so this option neednít be specified for a server running on the standard HTTP port. Of course, editing httpd.conf to add or change it isnít a great burden, either.
The user and group affect the suExec wrapper (covered shortly), so you must set them at build time. In Apache 1.3 you use the --server-uid and --server-gid options to do this. The corresponding Apache 2 options are --with-server-uid and --with-server-gid. For example, to set the user to httpd and the group to the httpd group, youíd use the following for versions 1.3 and 2, respectively:
[1.3]$ ./configure --server-uid=httpd --server-gid=httpd ...
You can set a number of other directives in httpd.conf that relate to the locations of things such as the document root and the default CGI directory by overriding parts of Apacheís default layout. I cover this in detail in the ďAdvanced ConfigurationĒ section a little later in the chapter.
Determining Which Modules to Include
Other than optimizing Apache for the platform itís to run on, the most useful aspect of building Apache is to control which modules are included or excluded. If you want to build a dynamic server, itís often simpler to build everything dynamically and then subsequently weed out the modules you donít want from the server configuration. However, choosing modules at build time is essential for static servers because you canít subsequently change your mind. It can also be useful on platforms where some modules simply wonít build and you need to suppress them to avoid a fatal error during compilation.
Apache will build a default subset of the modules available unless you tell it otherwise; you can do this explicitly by naming additional modules individually, or you can ask for bigger subsets. You can also remove modules from the list, which allows you to specify that you want most or all of the modules built, and then make exceptions for the modules you actually donít want.
You specify module preferences using the enable and disable options. The syntax of these is one of the areas where the Apache 2 and Apache 1.3 configure scripts differ quite significantly. In fact, itís likely to be one of the bigger problem areas for administrators looking to migrate. However, although the Apache 2 syntax is more flexible, it still offers essentially the same functionality. To simplify the task for administrators who are looking to migrate, Iíll present the various ways you can control the module list with examples for both versions of Apache.
Iíll also tackle building Apache as a fully static server first before going on to building it as a fully or partly dynamic server.
Enabling or Disabling Individual Modules
Apache 1.3 provides the generic --enable-module option, which takes a single module name as a parameter. To enable mod_auth_dbm and add it to the list of modules that will be built, use this:
[1.3] $ ./configure --enable-module=auth_dbm
Apache 2 replaces this with a more flexible syntax that provides a specific option for each available module. To fit in with the naming convention for options, module names with underscores are specified with Ė (minus) signs instead, so the previous command in Apache 2 becomes either one of these:
Disabling a module is similar. To remove mod_include and mod_userdir, which by default are included, use this:
[1.3] $ ./configure --disable-module=include --disable-module=userdir
or in Apache 2, use this:
As mentioned earlier, in Apache 2 you can use the new --enable-modules option along with a list of module names. Notice the pluralóthis isnít the same as Apache 1.3ís --enable-module. Unfortunately, thereís as yet no equivalent --disable-modules option. So to enable DBM authentication, URL rewriting, and all the proxy modules but disable user directories, as-is responses, and the FTP proxy, you could use this:
[2.0] $ ./configure --enable-modules="auth_dbm rewrite proxy" \
This adds mod_auth_dbm, mod_rewrite, and mod_proxy and then removes mod_userdir, mod_asis, and mod_proxy_ftp (which was enabled when you enabled mod_proxy).
You can obtain the list of available modules, and their default state of inclusion or exclusion, from the configure --help command. This produces an output that includes the following section (this particular example is from an Apache 1.3 distribution because Apache 2ís configure doesnít yet provide this information):
[access=yes actions=yes alias=yes ]
This tells you the names of the modules to use with configure and which modules Apache will build by default. Unfortunately, it doesnít take account of any other parameters you might add, so you canít use it to check the result of specifying a list of enable and disable options.
Once youíve run the configure script and set up the source code for compilation and installation, you can build and install Apache with this:
Once this is done, you can go to the Apache installation directory, make any changes to httpd.conf that you needósuch as the hostname, port number, and server administratoróand start up Apache. You could also just type make install, but doing it in two steps will allow you to perform a last-minute check on the results of the build before you actually install Apache.
blog comments powered by Disqus