Getting WordPress Up and Going

Setting up WordPress server there were a couple of minor wrinkles to sort out. I’ve run a blog before before and that fell by the wayside when I started using a personal wiki instead. But this seems like a good opportunity to see how one of the very popular blogging platforms works and what’s involved in keeping that running under the hood.

I work primarily with Debian systems, so that was a natural place to start. The wordpress package makes it very easy to get the base dependencies going with a known supported version, so if you’re running a recent release of Debian that seems like a reasonable place to start as well. That said, this of course means that the package is reconfigured along Debian guidelines and I found that I needed to spend a little time working out how this was done before it made sense.

Directory Structure – Symlinks and the Filesystem Hierarchy Standard

Probably the most important thing to know is the way the content directories have been set up to adhere to the Debian Filesystem Hierarchy Standard – that is:

/srv/www/wp-content/<blog hostname>/

  • This directory contains all per-blog custom changes to the global WordPress installation. Symlinks are used to bring in content from /var/lib/wordpress/wp-content (and then in turn from /usr/share/wordpress).
  • Shared resources are symlinked from: /var/lib/wordpress/wp-content/


  • Server-specific server-wide customization
  • Base level files/configuration are symlinked from: /usr/share/wordpress/


  • System-level files – treat as read only. These files are managed by the Debian package.
  • This is the Apache DocumentRoot of all WordPress instances on the server, the only content hosted from the previous two directories are under the wp-content sub-path of the blogs.
  • Note that .htaccess is symlinked to /etc/wordpress/htaccess (again to allow local customization without breaking the standard filesystem hierarchy).

There’s also some useful documentation at the Debian Wiki: WordPress

configuration Script – setup-mysql

The Debian package comes with a helper script to create the base database, configuration files and expected directory structure – this is /usr/share/doc/wordpress/examples/setup-mysql. Once used the apache configuration still needs to be manually updated, but the first step in setting up a new blog looks like:

sudo bash /usr/share/doc/wordpress/examples/setup-mysql -n brad_wordpress

Apache configuration

To activate the blog instance(s) create an apache config file along the lines of:

### The default virtual host should not point to wordpress
<VirtualHost *:80>
  ServerAdmin webmaster@localhost
  ErrorLog ${APACHE_LOG_DIR}/error.log
  CustomLog ${APACHE_LOG_DIR}/access.log combined
  UseCanonicalName Off
  Options All

# For this configuration to work you'll also need to have mod_rewrite #and mod_vhost_alias loaded and working in Apache.
# To enable these modules run
# # a2enmod rewrite && a2enmod vhost_alias && /etc/init.d/apache2 restart

# Allow wordpress overrides in shared .htaccess
<Directory /usr/share/wordpress>
  AllowOverride All

# Config for wordpress
<Directory /srv/>
  Options FollowSymLinks
  AllowOverride None
  Require all granted
<Directory /var/lib/wordpress/>
  Options FollowSymLinks
  AllowOverride None
  Require all granted

# To add new WordPress blog copy and adjust this template:
#<VirtualHost *:80>
#  ServerAdmin
#  ServerName XXXBlogHostNameXXX
#  ErrorLog ${APACHE_LOG_DIR}/XXXBlogHostNameXXX-error_log
#  TransferLog ${APACHE_LOG_DIR}/XXXBlogHostNameXXX-access_log
#  # Shared WordPress docroot
#  DocumentRoot /usr/share/wordpress
#  # wp-content in /srv/www/wp-content/$0
#  RewriteEngine On
#  RewriteRule ^/wp-content/(.*)$ /srv/www/wp-content/%{HTTP_HOST}/$1

# Current Blogs
<VirtualHost *:80>
  ErrorLog ${APACHE_LOG_DIR}/
  TransferLog ${APACHE_LOG_DIR}/

  # Shared WordPress docroot
  DocumentRoot /usr/share/wordpress

  # wp-content in /srv/www/wp-content/$0
  RewriteEngine On
  RewriteRule ^/wp-content/(.*)$ /srv/www/wp-content/%{HTTP_HOST}/$1

What About Multi-Site?

WordPress introduced multi-site hosting within a single instance in version 3.0 but there is manual work to set up independent blog hostnames (ie blogs that are not in a subdirectory or subdomain) and for the purposes of setting updown this blog server I was more interested in keeping the blogs separate to give more flexibility down the track.

User-Friendly URLs

To support user-friendly URLs (a switch in the configuration of each blog instance) the /etc/wordpress/htaccess file needs to be updated (uncomment the first <IfModule block).

Leave a Reply

Your email address will not be published. Required fields are marked *