[ Pobierz całość w formacie PDF ]

Installing from Source: Shared
If you wish to install mod_rewrite as a shared object, either because you ve already built
Apache and don t wish to have to rebuild it, or because you just happen to like running
your modules as shared objects, this section is for you.
5610_c03_final.qxd 1/10/06 1:15 AM Page 24
24 CHAPTER 3  % INSTALLING AND CONFIGURING MOD_REWRITE
You can install a module as a shared object either at the time that you build Apache
or after the fact. The effect is the same: you end up with a file called mod_rewrite.soin
your modulesdirectory, in the case of Apache 2.x, or in your libexecdirectory, in the case
of Apache 1.3.
This module can be loaded as necessary using the LoadModuledirective in your Apache
configuration file. This allows you to decide whether you want to load the module, and you
can also change your mind as often as you want, without having to recompile anything.
Modules can be compiled as shared objects during the initial installation of Apache, using
the techniques outlined in the sections that follow.
Installing mod_rewrite As a Shared Object on Apache 1.3
For Apache 1.3, the syntax is --enable-shared=rewritein the ./configurecommand line,
like this:
./configure --prefix=/usr/local/apache --enable-shared=rewrite [other options]
This will automatically include mod_sointo the configuration and configure
mod_rewrite to be compiled as a shared object. It will also add the necessary AddModule
and LoadModuledirectives to the default configuration file, so that the module will get
loaded when the server starts up.
The following directives will appear for mod_rewrite:
LoadModule rewrite_module libexec/mod_rewrite.so
AddModule mod_rewrite.c
Note that you can also tell the configure script to build everything as a shared object,
thus eliminating the inevitable confusion when some modules are shared and others
are not:
./configure --prefix=/usr/local/apache --enable-module=most --enable-shared=max
On the other hand, if you already have Apache 1.3 installed and only want to add
mod_rewrite to it as a shared object without recompiling Apache from scratch, you can
do so with the utility called apxs, which comes with Apache.
First, you will need to locate the source code of mod_rewrite itself. You can find it in
the downloaded Apache source code, in the src/modules/standarddirectory. Change into
that directory, and type
/usr/local/apache/bin/apxs -cia mod_rewrite.c
This will build the mod_rewrite.soshared object file, copy it into your Apache
modulesdirectory, and append the necessary configuration directives to your Apache
configuration file.
5610_c03_final.qxd 1/10/06 1:15 AM Page 25
CHAPTER 3  % INSTALLING AND CONFIGURING MOD_REWRITE 25
Note that if you installed Apache in some location other than /usr/local/apache,
apxswill be located at a different path.
Installing mod_rewrite As a Shared Object on Apache 2.x
For Apache 2.x, since the configure script is entirely different, so too are the options for
building mod_rewrite as a shared object. To build an individual module (such as
mod_rewrite) as a shared object, you may use the --enable-mods-sharedargument:
./configure --prefix=/usr/local/apache --enable-mods-shared='rewrite'
Several modules can be configured as shared objects by making this a space-
separated list:
./configure --prefix=/usr/local/apache --enable-mods-shared='rewrite dav dav-fs'
And, as with Apache 1.3, you can simply specify that all of the modules should be
built as shared objects by specifying the following:
./configure --prefix=/usr/local/apache --enable-mods-shared=most
In this case, only one line will be added to your configuration file to load
mod_rewrite:
LoadModule rewrite_module modules/mod_rewrite.so
If you already have Apache 2.x installed, you can add mod_rewrite, or any other
module, as a shared object using the apxsutility that comes with Apache.
The mod_rewrite source is located in the modules/mapperssubdirectory of your
Apache 2.0 source code directory. Change into that directory and type the following:
/usr/local/apache2/bin/apxs -cia mod_rewrite.c
This will build the mod_rewrite shared object file, copy it into your Apache modules [ Pobierz całość w formacie PDF ]

  • zanotowane.pl
  • doc.pisz.pl
  • pdf.pisz.pl
  • absolwenci.keep.pl
  •