Avoid using WordPress and Apache disk_cache extension together … unless you understand what is going on and you now how to fix the problem.

Using both together led one of the sites I have worked on (http://www.gdium.com) to display RSS feeds instead of posts and pages. After a forced refresh of the page (CTRL+R in Firefox) the correct page was displayed. This have been driving me crazy for several days until I actually remembered I had enabled Apache disk caching for another website on the same server.

After disabling disk_cache I did a search and I found someone that was having the same problem which confirmed what I thought.


In order to set a maintenance page in apache 2 you need:

  1. Enable mod_rewrite. In my debian server I just need to do the following:
    ln -s /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled/rewrite.load
  2. Create the maintenance page somewhere in your disk server. I created it under /srv/www/maintenance
  3. Set up apache2 to redirect all requests to your site to the maintenance page (you will need to comment out the current apache2 directives for your website). In my case I have a /etc/apache2/sites-available/mysite file that is linked from /etc/apache2/sites-enabled/mysite.
    #Maintenance page
    <VirtualHost *:80>
    ServerName mysite.com
    ServerAdmin postmaster@mysite.com
    RewriteEngine on
    RewriteCond %{REQUEST_URI} !/index\.html$
    RewriteCond %{REQUEST_URI} !/logo\.gif$
    RewriteRule ^(.*)$ /index.html [L]
    DocumentRoot “/srv/www/maintenance”
  4. Reload apache2 configuration:
    /etc/init.d/apache2 reload

In my case I only have an index.html and a logo.gif file in the /srv/www/maintenance folder. If you have more files that are needed to render the maintenance page you will need to add some extra “RewriteCond %{REQUEST_URI} !/yourfile\.extension$” rules.

Note if you do not use the rewrite engine, the maintenance page will show up when you users access http://mysite.com or http://mysite.com/index.html, but if they access http://mysite.com/something_else they will get a nice “Page not found error”.

When one of the hard disks in a RAID 1 gets out of the RAID because it is no longer in sync with the other disk, you can easily resynchronize it with the following command:

raidhotadd /dev/mdX /dev/sdY

X and Y should be set to the appropriate values.

‘cat /proc/mdstat’ would tell you if your RAID system is healthy.

The configuration of your RAID is set in the file /etc/raidtab which will tell you the disks in the RAID and you can compare the results with the cat command above to see which disk is missing.

I use this script to verify if all disks in my RAID 1 are working fine:

#Check if both drive are up
if [ `grep [UU] /proc/mdstat | wc -l` != 2 ] || [ `grep "2/2" /proc/mdstat | wc -l` != 2 ]; then
  cat /proc/mdstat
  exit 1
exit 0

More info here.