HomeApache Page 4 - Getting Started with Apache 2.0, Part 1
Configuration Options - Apache
In this first article in a three-part series, Harish Kamath helps you download and configure the Apache Web server. If you've wanted to use PHP with Apache, look no further; that part of the setup is also covered here.
In the previous section, I've demonstrated how you can get off the blocks by installing an "out-of-box" configuration of the Apache Web server. However, the primary advantage of Open Source software is the ability to customize and fine-tune the software as per your whim and fancy - and the Apache Web server is no different.
In this section, I will outline the options that one can use with the "configure" command - this helps you to compile a Web server that you want rather than force you to use a version that everyone else uses. Talk about power!
Before I list them, I would like to point out that most options, which require you to specify a value, have the following general syntax:
You've already been introduced to the "--prefix" option. Now its time to say hello to the "--exec-prefix" option, that allows you to specify the location for the "architecture-dependent" files. All the binary files, C library files, manual files and so forth are stored under this location. So, you might want to do a re-think before you decide to specify a custom value for this parameter. For the record, this defaults to value specified in the "prefix" option.
Next, you have a bunch of options that allow you to further fine-tune the location of different files, listed in the above paragraph. As the name of each option (in the list below) suggests, each is specific to a particular set of files whose location it controls:
the "--bindir" option: you can specify the location for different Apache executables such as httpd, htpasswd, and so forth.
the "--includedir" option: the location of the C header files are governed by this parameter.
the "--mandir" option allows us to customize where we can install the manual files.
the "--sysconfdir" option controls the folder where the configuration files such as the "httpd.conf" are installed.
As already mentioned, one of the distinct advantages of Apache is the ability to fine-tune your local installation because of its modular structure. Each add-on feature, supported by the Web server, is available in the form of a module that can be either compiled statically into the binary or loaded dynamically as a DSO module when the server starts. For example, if you wish to enable LDAP with your Apache installation, you'll need to enable the "mod_ldap" module.
A little note about DSO (an acronym for Dynamic Shared Objects) modules would be appropriate before I proceed further. It is quite possible that the default configuration of Apache does not support modules that you may need in the future. Consider the "mod_ldap" LDAP module. When you compiled Apache for the first time, you did not foresee the need for this module. However, a few months later, you are asked to enable it. The only option, then, would be to go through the entire rigmarole of compiling the server all over again.
This is not how it works with DSO modules. You can compile the modules that you may (or may not) require in the future as DSO modules (I'll show you how, in a moment) and then you can tweak the Apache configuration file to load them at start-up, as required.
Coming back to our "configure" command - note that you can disable any modules that are compiled, by default, in the current version of Apache using the following generic syntax:
Here are some of the modules that you can disable with the "configure" command:
"--disable-auth" disables the features provided by the "mod_auth" module.
"--disable-autoindex" does not allow the server to display directory listings.
"--disable-cgi" prevents CGI scripts from being executed on the server.
"--disable-include" turns off Server Side Includes in your Web pages.
"--disable-http" disables the HTTP protocol itself - DO NOT even think about using this option unless you are really sure of what you're doing.
That was a just a partial list. The URL at the end of this section will provide you with a complete list of all such modules.
Now that you've seen how to disable modules compiled into the Web server, you'll be surprised to learn that there are some modules which are compiled but not enabled. In order to enable these modules, we have two options: you can use "--enable-mods-shared" that allows us to dynamically load the list of modules, or use the "--enable-modules" option to bind a set of modules statically, as shown below:
And if you are feeling too lazy to list the modules at the command line, you can opt for the "most" and "all" keywords with the "--enable-mods-shared" option, which will compile "most" and "all" modules as DSO modules.
But, there are always a few who love to type;they can use module specific options to enable the corresponding modules. The general syntax for such options is as follows:
This builds the specified module as a DSO where as the following syntax will compile the same module, statically:
Finally, there are always some modules that are not a part of the Apache project. For example, if you wish to configure PHP to work with the Apache Web server, you'll need a generic mechanism that allows you to load third-party Apache modules at start-up. This is where the "--enable-so" option comes in handy - this allows you to load such third-party libraries as the server starts.
That's about it as far as the powerful "configure" command is concerned. Before you proceed to the next section, take a look at the following URL for more details about the installation process: http://httpd.apache.org/docs-2.0/install.html