Why does Apache link sites-enabled/000-default to sites-available/default?

I was cleaning up Apache config and removed the default 000-default & default-ssl from the Apache sites-enabled sub-folder. To my surprise the default page now goes to a web app that I did not expect. It took me a sec to realize 2 things:

  1. The first VirtualHost config that has format *:80 (HTTP) or *:443 (HTTPS) was considered the default site
  2. Apache loaded files in alphabetical order

So I prepended my blog config file with 000- and now blog is the default site across simpleit.us

Edit: This site is now powered by NginX

Enable caching for WordPress on Apache

I’m running WordPress on Apache. I enabled 2 level caching: at Apache level for static media (css, js, images) and at WP level for dynamic data. Here how the things are done:

1. Apache

This part is a bit tricky. You need to install and enable mod_expires and then update .htaccess file at the top folder of WP blog.

mod_expires comes with your regular Apache 2.0 and 2.2 installation.

  • Enable with “sudo a2enmod expires”
  • Restart apache with “sudo /etc/init.d/apache2 restart” or “sudo apache2ctl restart”
  • Open your .htaccess at the top folder of WP blog folder and append to the end of the file the following part (make sure you remove extra spaces after < and before > for Apache directives):

[cc lang=”apache”]

< IfModule mod_expires.c >
ExpiresActive on
ExpiresDefault “access plus 1 month”
ExpiresByType image/png “access plus 1 month”
ExpiresByType image/gif “access plus 1 month”
ExpiresByType image/jpeg “access plus 1 month”
ExpiresByType image/bmp “access plus 1 month”

ExpiresByType text/css “access plus 1 month”

ExpiresByType text/js “access plus 1 month”

AddType image/vnd.microsoft.icon .ico
ExpiresByType image/vnd.microsoft.icon “access plus 3 months”
< /IfModule >

[/cc]

Read more on mod_expires at http://httpd.apache.org/docs/1.3/mod/mod_expires.html and http://httpd.apache.org/docs/2.0/mod/mod_expires.html.

2. WordPress

WP Super Cache plug-in doesn’t give me much clue how things work and it’s rather complicated. I installed WP-Cache instead. Pretty simple.

Here are the results after enabling caching: