WordPress is a web content management system. It was originally created as a tool to publish blogs but has evolved to support publishing other web content, including more traditional websites, mailing lists and Internet forum, media galleries, membership sites, learning management systems and online stores. In this guide we will be creating a jail in order to install our own WordPress instance. This guide asumes that already have iocage installed. If you do not please see our FreeBSD NAS post for information on istallation.
First we create our jail. Be sure to set your release and ip addresses to suit your setup. Then check for any updates.
# iocage create -r 13.2-RELEASE -n wp ip4_addr="vnet0|192.168.0.31/24" defaultrouter="192.168.0.2" vnet="on" boot="on" allow_raw_sockets="1" # iocage console wp # freebsd-update fetch install # exit
Login and begin installation. Install pkg system and some useful tools.
# iocage restart wp # iocage console wp # pkg update # pkg upgrade -y # pkg install -y nano rsync
Install Apache web server and PHP then set Apache to serve PHP files.
# pkg install -y apache24 # sysrc apache24_enable="YES" # service apache24 start # pkg install -y php83 php83-mysqli mod_php83 # cp /usr/local/etc/php.ini-production /usr/local/etc/php.ini # rehash # nano /usr/local/etc/apache24/modules.d/001_mod-php.conf
<IfModule dir_module>
DirectoryIndex index.php index.html
<FilesMatch “\.php$”>
SetHandler application/x-httpd-php
</FilesMatch>
<FilesMatch “\.phps$”>
SetHandler application/x-httpd-php-source
</FilesMatch>
</IfModule>
# service apache24 restart
Install The MySQL database server. Then run the mysql_secure_installation, remember your password for later.
# pkg install -y mysql80-server # sysrc mysql_enable="YES" # service mysql-server start # mysql_secure_installation
Now we can Begin our wordpress installation. Install the PHP extensions required by WordPress.
# pkg install -y php83-xml php83-gd php83-curl php83-tokenizer php83-zlib php83-zip php83-intl php83-mbstring php83-ftp php83-ctype php83-dom php83-posix php83-filter php83-iconv php83-simplexml php83-sockets php83-xmlreader php83-mysqli php83-pdo_mysql
To craft human-readable URLs, WordPress uses the mod_rewrite module. First, open the Apache configuration file using nano to enable it. this is also a good time to set servername/serveradmin and any other settings to your needs.
# nano /usr/local/etc/apache24/httpd.conf
# LoadModule rewrite_module libexec/apache24/mod_rewrite.so
Un-comment the above line by removing the # symbol at the beginning to enable the mod_rewrite module.
LoadModule rewrite_module libexec/apache24/mod_rewrite.so
Save and close the file. Restart Apache to load the new configuration.
# service apache24 restart
Performing sanity check on apache24 configuration:
Syntax OK
Stopping apache24.
Waiting for PIDS: 77335.
Performing sanity check on apache24 configuration:
Syntax OK
Starting apache24.
Create the WordPress Database. Log in to your MySQL server as root.
# mysql -u root -p
Enter your root password and press ENTER to proceed.
At the MySQL prompt, enter the commands below to create a wordpress database and a wp_user user. Replace EXAMPLE_PASSWORD with a strong value.
root@localhost [(none)]>
CREATE DATABASE wordpress;
CREATE USER ‘wp_user’@’localhost’ IDENTIFIED WITH mysql_native_password BY ‘EXAMPLE_PASSWORD’;
GRANT ALL PRIVILEGES ON wordpress.* TO ‘wp_user’@’localhost’;
FLUSH PRIVILEGES;
Exit from the MySQL command-line interface.
root@localhost [(none)]> QUIT;
Bye
root@wp:~ #
Configure the Virtual Host File. Apache will serve the WordPress site from the /usr/local/www/apache24/data/ directory. Create a child WordPress directory in this location.
# mkdir -p /usr/local/www/apache24/data/wordpress # nano /usr/local/etc/apache24/Includes/wordpress.conf
Enter the information below into the file. Replace example.com and we*******@*****le.com with your values.
<VirtualHost *:80>
ServerAdmin we*******@*****le.com
ServerName example.com
DocumentRoot /usr/local/www/apache24/data/wordpress
<Directory /usr/local/www/apache24/data/wordpress>
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Save and exit the file.
Restart Apache to load the new changes.
# service apache24 restart
Download and Install WordPress, Navigate to the tmp directory.
# cd /tmp
Download the latest version of WordPress and Unpack the WordPress tarball.The Copy the files to the WordPress site directory that you created earlier..
# curl -O https://wordpress.org/latest.tar.gz # tar xzvf latest.tar.gz # rsync -rtv /tmp/wordpress/ /usr/local/www/apache24/data/wordpress
Navigate to the /usr/local/www/apache24/data/wordpress directory. Copy the sample configuration file to wp-config.php. Create an upgrade directory under the wp-content directory. Change the ownership of the /usr/local/www/apache24/data/ directory to the Apache user www.
# cd /usr/local/www/apache24/data/wordpress # cp wp-config-sample.php wp-config.php # mkdir wp-content/upgrade # chown -R www:www /usr/local/www/apache24/data
Configure WordPress. The WordPress software relies on some salts and keys for security purposes. Grab some unique values from the WordPress API endpoint using the curl command. Copy the values to your clipboard. Edit the WordPress configuration file.
# curl -s https://api.wordpress.org/secret-key/1.1/salt/ # nano /usr/local/www/apache24/data/wordpress/wp-config.php
Locate the database settings below.
…
define( ‘DB_NAME’, ‘wordpress’ );
/** MySQL database username */
define( ‘DB_USER’, ‘wp_user’ );
/** MySQL database password */
define( ‘DB_PASSWORD’, ‘change password_here’ );
…
Match the values to the database name, user account, and password that you created earlier. Save and close the file.
Locate the keys and salts below and replace them with the values you retrieved from the WordPress API.
…
define( ‘AUTH_KEY’, ‘put your unique phrase here’ );
define( ‘SECURE_AUTH_KEY’, ‘put your unique phrase here’ );
define( ‘LOGGED_IN_KEY’, ‘put your unique phrase here’ );
define( ‘NONCE_KEY’, ‘put your unique phrase here’ );
define( ‘AUTH_SALT’, ‘put your unique phrase here’ );
define( ‘SECURE_AUTH_SALT’, ‘put your unique phrase here’ );
define( ‘LOGGED_IN_SALT’, ‘put your unique phrase here’ );
define( ‘NONCE_SALT’, ‘put your unique phrase here’ );
…
Save and close the file. Finalize WordPress Installation. Visit your server’s URL in a web browser, with the domain name or public IP address of your webserver.
http://192.168.0.31
Select a language and click Continue. Enter your site information and click Install WordPress to proceed. Log in to your new WordPress site.







Provoked thought and taught me something new, as if my brain needed more exercise.
Beautifully written and incredibly informative, The post has made a lasting impression on me. Thank you for sharing The thoughts.
Tackled this hard to understand issue with elegance. I didn’t know we were at a ballet.
I’m amazed by The knowledge, almost as much as I’m drawn to the way you present it. Share more, please?
Testament to The expertise and hard work, or The ability to make me feel utterly unaccomplished.
The Writing has become a go-to resource for me. The effort you put into The posts is truly appreciated.
Always excited to see The posts, like waiting for a message from a crush. Another excellent read!
Somebody essentially lend a hand to make significantly posts I might state That is the very first time I frequented your web page and up to now I surprised with the research you made to create this particular put up amazing Excellent job.