Introduction

Assuming you have varnish installed on your server and you started to catch the pages on it.Your webserver is now missing the hits to your pages.

Well, that is great for your webserver load, but not too good for your statistics analysis, because /var/log/apache/access_log will miss the hit.

Configure varnishncsa:

We’ll use varnishncsa to get the logs that awstats will be able to analyse like:

varnishncsa [?a] [?b] [?C] [?c] [?D] [?d] [?f] [?I regex] [?i tag] [?n varnish_name] [?P file] [?r file] [?V] [?w file] [?X regex] [?x tag]

Add this line in the /etc/rc.local file:

Continue Reading…

Varnish is a web accelerator. Its mission is to sit in front of a web server an cache the content. It makes your web site go fast.
In this mode, Varnish will stop incomplete HTTP requests from reaching your Apache webserver.

Installing Varnish:

Varnish is distributed in the Debian package repositories, but the version there might be out of date, and  generally recommend using the packages provided by varnish-cache.org or packages from backports.debian.org.

To use the varnish-cache.org repository and install varnish, do the following:

Change Varnish settings:

1. First change the default port.  Edit /etc/default/varnish:

Continue Reading…

Virtual hosts are used to run more than one web site on a single machine.
Virtual hosts can be “IP-based”, meaning that you have a different IP address for every web site, or “name-based”, meaning that you have multiple names running on each IP address.

I want to show you one of mine scripts for easy create virtual hosts in Debian Squeeze or ubuntu.

#!/bin/bash
VHOST_CONF=/etc/apache2/sites-enabled/
ROOT_UID=0
NOTROOT=87
WWW_ROOT=/var/www/

# Check if is root
if [ “$UID” -ne “$ROOT_UID” ]
then
echo “You must be root to run this script.”
exit $NOTROOT
fi

if [ -n “$1” ]
then
DOMAIN=$1
else
echo “You must provide a full domain name for this site, i.e. ‘example.com’ ”
echo -n “Run this script like ./script example.com .”
exit
fi

#Create document root site folder
mkdir -p $WWW_ROOT/$DOMAIN

Continue Reading…

On Debian systems … Apache comes with mod_status compiled by default.
mod_status provides information on the Apache server activity and performance.
This tutorial will show you how to enable this feature, so that only requested issued from localhost are accepted and served.

Setting mod_status up:

By default, server status report is commented so you can not access it. To enable it, you need to uncomment from /etc/apache2/apache2.conf:

<Location /server-status>
    SetHandler server-status
    Order deny,allow
    Deny from all
    Allow from .your_domain.com
</Location>

Continue Reading…

You can give user based web pages in your apache based  server.

Follow the simple steps shown below after installing apache:

$ cd /etc/apache2/mods-enabled

$ sudo ln -s ../mods-available/userdir.conf userdir.conf

$ sudo ln -s ../mods-available/userdir.load userdir.load

$ sudo /etc/init.d/apache2 restart

and

make directory at your home folder named public_html as normal user($ mkdir public_html)

now browse with address

http://127.0.0.1/~username

Page 5 of 71234567