(original) ubuntu14.04 installation apache+modsecurity

Source: Internet
Author: User
Tags modsecurity

platform: Ubuntu 14.04

First step: Install Apache

I recommend installing Apache with Apt-get installation, so you can have a lot less library support!!!! If it's not too much trouble, you can install it by source.

Input Apt-get Install Apache2

If you are prompted to update the package without this package apt-get install update

This step is installed after the Apache will be able to provide services, enter can access the local site

Step Two: Install Modsecurity

This is also the same as the top, using

Apt-get install libxml2 libxml2-dev libxml2-utils libaprutil1 libaprutil1-Dev Libapache2-modsecurity

After you install it, you can see what the version number of your modsecurity is, using

Dpkg -s libapache2-modsecurity | grep Version

Step three configuration modsecurity

Service Apache2 Reload

After the command takes effect, the Modsecurity log file is generated in the/var/log/apache2/directory Modsec_audit.log

using the modsecurity core rule set

Place the set of rules we think of using in the following directory

CD /usr/share/modsecurity-CRS/activated_rules/ 

Select Enable Base rule set

For F in $(ls : /base_rules/); Do   Ln -s .. /base_rules/$f;  Done 

Modify Apache module configuration, enable rule set

Note: There are some differences between the Modsecurity 2.7 version and the 2.6 version of the configuration file

(1) Version 2.7

Vim /etc/apache2/Mods-available/security2.  conf           


<IfmoduleSecurity2_module># Default Debian dir for modsecurity ' s persistent dataSecdatadir/Var/Cache/Modsecurity# Include all the *.conf files in/etc/modsecurity.# Keeping your local configuration in that directory# would allow for a easy upgrade of the This file and# Make your life easierIncludeoptional/etc/Modsecurity/*.conf        IncludeOptional  /usr/share< Span class= "pun" >/modsecurity-crs/*.< Span class= "PLN" >conf        includeoptional  /usr/share< Span class= "pun" >/modsecurity-crs/activated_rules/*.</ifmodule>       

(2) version 2.6

vim /etc/apache2/Mods-available/mod-security.  conf               


  include /etc/modsecurity/*. confinclude /usr/share/modsecurity-crs/*.confinclude /usr/share/modsecurity-crs/activated_rules/*. Conf 

above reference: Http://www.freebuf.com/articles/web/43559.html?pcoaakbclgkumyws

start modsecurity module
A2enmod headersa2enmod security2 (version 2.6: a2enmod mod-security)service apache2 Restart

Once this has been modified, a 403 error is displayed using the IP address!!!!!! For this mistake, a day, in the Internet search all kinds of 403 errors is not, why????
View Errol.log can be found, is modsecurity inside prohibit the use of IP access!!!!!! Use localhost to access the ...
So, looking at the log is a very important thing.


(original) ubuntu14.04 installation apache+modsecurity

Related Article

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.