Learn. Share. Profit.

Main menu

Tag Archives: Apache

This is just a quick guide to eliminate certain activity from your access_log files.

Create a new file called filter.conf (where you put this depends on your apache deployment). Adapt the patterns as necessary. See apache docs for all the possible variables. You can pile up as many filters as you like.
SetEnvIFNoCase User-Agent "Googlebot" exclude_from_log
SetEnvIfNoCase Request_URI "\.(gif)|(jpg)|(png)|(css)|(ico)$" exclude_from_log
SetEnvIfNoCase Request_Method "(OPTIONS)|(PROPFIND)" exclude_from_log

This file should be included (probably at the global level) for easiest use. For OS provided apache, either put it in /etc/httpd/conf.d or explicitly include it into httpd.conf.

Anywhere you want the filter applied, simple alter you access_log definition to include the parameter after “combined”.
CustomLog "logs/access_log" combined env=!exclude_from_log

Restart apache to pick up the change and review your access_log to make sure it worked.

When Apache is behind a load balancer, frequently the load balancer IP will be recorded in the access/error logs instead of the actual client IP. This module modifies the inbound requests to show the actual client IP instead of the load balancer IP. This does not work for every load balancer.

4. The module will be installed correctly in /usr/local/apache/modules
5. Create a new folder called custom under /usr/local/apache/conf
6. Create a file called httpd-modrpaf.conf in /usr/local/apache/conf/custom with the following content
LoadModule rpaf_module modules/mod_rpaf-2.0.so

7. Replace 1.2.3.4 with the IP address of the load balancer.
8. Update the RPAFheader with the correct value if your load balancer does not pass “X-Forwarded-For”.
9. Make sure you include the new “custom” folder in your main httpd.conf
Include /usr/local/apache/conf/custom/*.conf

3. The module will be installed correctly in /usr/local/apache/modules
4. Create a new folder called custom under /usr/local/apache/conf
5. Create a new file called httpd-modflvx.conf in /usr/local/apache/conf/custom with the following content
LoadModule flvx_module modules/mod_flvx.so
AddHandler flv-stream .flv

<IfModule mime_module%gt;
AddType video/x-flv .flv
</IfModule>

6. Make sure you include the new “custom” folder in your main httpd.conf
Include /usr/local/apache/conf/custom/*.conf

If you followed my post on Apache from source, then you’ll also want to review these additional steps. Unless otherwise specified these steps are for modification of the httpd.conf file found in “/usr/local/apache/conf”.

2. Add the following excerpt to disable access to .svn/.git folder contents (put below similar rule for .ht* files):
#
# The following lines prevent .svn folders from being
# viewed by Web clients.
#
<DirectoryMatch "\.svn">
Order allow,deny
Deny from all
Satisfy All
</DirectoryMatch>

#
# The following lines prevent .git folders from being
# viewed by Web clients.
#
<DirectoryMatch "\.git">
Order allow,deny
Deny from all
Satisfy All
</DirectoryMatch>

5. Insert the following at the bottom of the file:
AddDefaultCharset Off