Add modules dynamically for Apache

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.