Apache Tutorials and Examples

How to install AWStats on Ubuntu Linux

AWStats is a powerful and featureful tool to analyze apache access logs. Using AWStats, you can view various stats 404, etc. Here are steps to read more

ApacheBench (ab) – how to load test a web site

ApacheBench (ab) is a very handy webserver benchmarking tool which can be run from command line. It is extremely simple to use. A quick outcome read more

Apache – add basic auth to a location or directory

In case you want to protect a directory from public access, you can add Apache basic auth to it. This may be needed if you read more

Block directory access using htaccess 404

RewriteRule in Apache .htaccess is a convenient way to block directory access to a directory in your Apache document root. This can be useful to read more

How to set different HTTP Expire Header for multiple images of same type

HTTP expire header can be used to set a expiry time for an image, css or any other content type. The browser does not fetch read more

Disable directory listing in apache

Apache 2.4 on Ubuntu Linux has directory listing enabled by default. In case you are upgrading from apache 2.2 or creating a new site, you read more

Apache – list loaded modules on Ubuntu

To list loaded module in Apache on Ubuntu linux, command line tool apachectl can be used. Here is an example. $ apachectl -M Loaded Modules: read more

Why and how to log Content-Type in apache access log

It is very handy to log Content-Type in apache access log. It can be used to grep visit of specific content-type (e.g. text/html). Here is read more

How to log page latency and url host in apache log

Apache log can give you lot of insight into the performance of your site. The default configuration of apache does not log the page serving read more

Monitor apache using mod_status on Ubuntu

Apache installation on Ubuntu Linux automatically installs mod_status also. mod_status can be used to view server activities and performance from a web interface. Here are read more

Using python to analyze bots from apache logs

Apache logs contains pretty useful information about various visitors and bots coming to your site. Here is how a typical apache log entry looks like: read more

Apache – how to remove php extension from url

Remove php extension from a specific url To remove php extension from a url (e.g. /foo/bar.php) the following Apache rewrite rule can be used: RewriteRule read more

egrep pipe example on Apache access log

Some egrep pipe examples for Apache access logs on Ubuntu Linux egrep http status code 301 entries $ cat /var/log/apache2/access_log.2015-11-29 | egrep ” 301 ” read more

PHP – How to log custom data in apache access log

Apache lets you log a specific apache sub process environment variable in access log. PHP lets you set apache sub process env variable using apache_setenv. read more

Command line – top IP list from apache access log

Linux (or Unix) command line utilities like awk, sort, uniq, can be used to analyze apache log to get interesting stats. One use case is read more