Host WordPress using Apache 4.2

Want to host your own WordPress installation with a recent version of the apache webserver (e.g. apache 4.3). Here you find everything you need. If you have been upgrading from an older apache version there might be a little obstacle you have to get around but with the directory permissions which is already perfectly fixed in the code sample below. Setting up WordPress is really easy. Here all the steps needed:

1. Download WordPress from WordPress.org

2. Unpack the Zip Archive you just have downloaded and put it into the document root of your webserver

3. Create a virtual host for your new apache installation.

To create the virtual host you simply have to put the following code snippet into your httpd.conf. In the following example the blog has been unpacked in the directory /var/www/myblog

[sourcecode language=”bash”]
<VirtualHost *:80>

DocumentRoot /var/www/mydailyhacks

ServerName www.mydailyhacks.org
ServerAlias mydailyhacks.org *.mydailyhacks.org

<Directory "/var/www/mydailyhacks/">
Require all granted
Options FollowSymLinks
AllowOverride Limit Options FileInfo
DirectoryIndex index.php
</Directory>

</VirtualHost>
[/sourcecode]

Make sure that you use all the directory setting exactly as they show up here, otherwise you will run in trouble.

4. The last step before you can activate your blog is setting up a MySql data base which can be used by wordpress. This is a lot easier than it sounds. Assuming you are running linux you have to make sure that the mysql-server is installed. In Fedora, Centos etc. you can achieve this by typing

[sourcecode language=”bash”]
yum install mysql-server
/sbin/service mysqld start
[/sourcecode]

5. Now you only have to set up a new user and (in the example for simplicity the root user is used) and create the database for your WordPress install.

[sourcecode language=”bash”]
mysqladmin -u root password ‘mypassword’
mysql -u root -pmypassword
CREATE DATABASE wordpress;
[/sourcecode]

5. Just contact your virtual server now under the address you defined in step 3. The automatic setup interface for your new blog will show up. Enter wordpress at database name and also enter the username and password which have been defined before.

Thats it! Enjoy your new self-hosted blog!

Leave a Reply