If you have received this error while you were restarting the Apache2 server on Debian Squeeze:

/etc/init.d/apache2 start
Starting web server: apache2apache2: Could not reliably determine the server’s fully qualified domain name, using for ServerName

To fix this problem  you need to edit the /etc/apache2/apache2.conf.

1. Open the /etc/apache2/apache2.conf file with your favorite editor.

vim /etc/apache2/apache2.conf

2. Now add the following line:

ServerName localhost

3. Restart apache2 server:

 /etc/init.d/apache2 restart
Restarting web server: apache2 … waiting ..

Now your problem is gone. Enjoy.

Here is how to change from apache2-mpm-prefork to apache2-mpm-worker, , when having used mpm-prefork before, and php5, on Debian Squeeze.

Step1. Stop Apache2:

# /etc/init.d/apache2 stop

Step2. Install apache2-mpm-worker:
That will remove some packages, like apache2-mpm-prefork and libapache-mod-php5, and install apache2-mpm-worker, and php5-cgi instead.

# apt-get install apache2-mpm-worker

Step3. Set Apache2 to use php5-cgi:

Continue Reading…

If you run an Apache2  server then you have no doubt seen the following error messages a thousand times in your error.log file:

File does not exist: /var/www/robots.txt

File does not exist: /var/www/favicon.ico

As you know by now  not having a favicon.ico file  web browsers will requesting  it each time. But you can tell Apache2  not to log the event as a mistake message.

You will still see the request in the access.log, but at least you will have a cleaner error.log file.


Continue Reading…

In the following tutorial  i will explain the installation of the apache2 module “mod_evasive“.
Mod_evasive tracks the number of requests for files on the Apache2  server and blocks the delivery in case a certain limit is reached.

Step1. Install mod_evasive module:

apt-get install libapache2-mod-evasive

Step2. Create the log directory for mod_evasive:

mkdir -p /var/log/apache2/evasive

NOTE: Make sure the www-data user will have access to create logs:

chown -R www-data:root /var/log/apache2/evasive

Step3. Now edit the configuration file for the module 0 located in /etc/apache2/mods-available/mod-evasive.load like this:

vim /etc/apache2/mods-available/mod-evasive.load

After edit the file will look  like this:

LoadModule evasive20_module /usr/lib/apache2/modules/mod_evasive20.so
 <IfModule  mod_evasive20.c>
 DOSHashTableSize 3097
 DOSPageCount 5
 DOSSiteCount 120
 DOSPageInterval 1.5
 DOSSiteInterval 1.5
 DOSBlockingPeriod 10
 DOSLogDir "/var/log/apache2/evasive"

This config seems to be optimal for me.

Step4. Enable the module and restart apache:

a2enmod mod-evasive
 /etc/init.d/apache2 restart


If you discovered that proxying your webserver with varnish breaks PhpMyAdmin I’ve got the solution:

Problem is that the backend webserver, apache2 or nginx doesn’t even know it’s running behind another software.

Varnish does a completely normal request to webserver. Most times this isn’t any problem at all.

PhpMyAdmin tries to be “smart” and figure out its absolute URL and I run the apache2 or nginx backend on port 80.

The solution is to force an URL.

Add the following line to “config.inc.php“, changing the obvious:

$cfg['PmaAbsoluteUri'] = 'http://yourdomain.com/phpmyadmin/';