Apache has been installed and put into operation, but later found that some modules did not load, of course, there are two ways:
1. One is to completely recompile Apache, then install
2. Compile the module as so file and load the extension module with the loadmodule instruction.
This is just the second way.
Scenario: You now need to enable Apache's deflate module, which is compressed output, to speed up website downloads and save network bandwidth
Server Red Hat as 4
Aapache installed in/usr/local/apache2/
Apache installation source files are saved under/usr/local/soft/httpd-2.2.8/
Requirement: Load MOD_DEFLATE.C module to enable Apache to support compressed output
1. Now check the/usr/local/apache2/conf/httpd.conf, not found similar: LoadModule deflate_module modules/mod_deflate.so
Description, Apache did not load this module
2. Re-check/usr/local/apache2/modules/, in this directory did not find the mod_deflate.so file, stating that this module is not compiled, you need to compile the module, then load the
3. First enter the directory where the mod_deflate.c file is located:
[Roo[email protected] ~/]#cd/usr/local/soft/httpd-2.2.8/modules/filte R
4. Compiling the target module with the Apxs file
[Email protected]/usr/local/soft/httpd-2.2.8/modules/filters]#/usr/local/apache2/bin/apxs-i-c-a mod_ Deflate.c
Description:-I installation,-C compile the specified module-a activation module (i.e. add loadmodule instruction to httpd.conf)
Operation Result:
................
----------------------------------------------------------------------
chmod 755/usr/local/apache2/modules/mod_deflate.so
[Activating module ' deflate ' in/usr/local/apache2/conf/httpd.conf]
Indicates that the module is compiled and stored as/usr/local/apache2/modules/mod_deflate.so, and the module is automatically activated in httpd.conf
Well, now that we check/usr/local/apache2/conf/httpd.conf, we'll find that the program has been automatically added
LoadModule Deflate_module modules/mod_deflate.so
5. Then, we can restart Apache:
[Email protected] ~]#/usr/local/apache2/bin/apachectl Restart
If you find that the module file already exists in the second step above, you do not need to compile the module, manually modify the httpd.conf, restart Apache can
Add modules dynamically for Apache