Install WordPress on OpenBSD 6.2

Last Updated: Fri, Mar 9, 2018
BSD Blogging Server Apps
Archived content

This article is outdated and may not work correctly for current operating systems or software.


WordPress is the dominant content management system on the internet. It powers everything from blogs to complex websites with dynamic content. This tutorial will discuss getting WordPress up and running on OpenBSD 6.2.

Before we begin, there are some small housekeeping items that need to be taken care of in order for WordPress to function correctly. Please do not skip these steps, because if you do, you will get some very generic errors that are next to impossible to decipher. Remember that OpenBSD's internal httpd server runs in a chroot environment and these housekeeping steps account for this.


Create the directory /var/www/etc and keep the default permissions.

Create a new file called hosts and add the following entries. This will allow WordPress to download updates, themes, and plugins.       localhost

Install some prerequisite packages.

pkg_install php-5.6 php-fastcgi php-curl php-mysql php-zip mariadb-server mariadb-client

pkg_install wget unzip 

Copy the sample ini files from /etc/php-5.6.sample to /etc/php-5.6/.

Create an /etc/httpd.conf file similar to the one below. You can optionally replace the server name "default" with the actual name in DNS, but that is not strictly necessary.

types { include "/usr/share/misc/mime.types" }

server "default" {

    listen on egress port 80

    root "/wordpress"

    directory index index.php

    location "*.php*" {

            fastcgi socket "/run/php-fpm.sock"



Now it is time to enable the necessary daemons so they launch at system startup.

rcctl enable php56_fpm 

rcctl enable httpd

rcctl enable mysqld


Download WordPress, then move it into /var/www and set the correct permissions.

cd /tmp



mv wordpress /var/www/.

chown -R www:www /var/www/wordpress/

Setup MariaDB to provide the database for WordPress. Running mysql_secure_installation is recommended because it can remove anonymous users and the test database. Furthermore, a root password for MariaDB is set.


rcctl start mysqld


Create the WordPress database. Make certain to replace Password with the password that you intend to use.

mysql -u root -p <password goes here>


CREATE USER 'wordpress'@'localhost' identified by 'Password';

GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpress'@'localhost' IDENTIFIED BY 'Password'; 



Now that you have created the WordPress database, it is time to start the web server and the fastcgi daemon.

rcctl start httpd

rcctl start php56_fpm

From here, open up a web browser and browse to your website, e.g. You will see the WordPress Installation Wizard. On the next screen, you will be prompted for the database name, database username, database password, server, and the table prefix.

The database name defaults to "wordpress". Make certain to set the database user to "wordpress" and use the same password as when you created the database previously. Finally, change the server to and leave the table prefix as-is.

The wizard should properly populate the database and then prompt you to create an "admin" user. Once this is completed, you are ready to download themes and plugins and begin your website design. On a closing note, be sure to keep an eye on new versions and keep your WordPress install up to date. The further you get away from the current version, the harder upgrades tend to be.

Want to contribute?

You could earn up to $600 by adding new articles.