WordPress is an open source software to build websites and blogs and a content management system (CMS). It is one of the most popular web publishing tool in the world and is based on PHP and MySQL. 30% of the world’s websites are powered by WordPress and people choose them for over 11000 template themes, no-code platform, plugins and widgets.
Following this guide you will learn how to host your WordPress website or blog on Northflank. Configuration data will be stored in a MySQL database and content and media uploads will use persistent volumes.
Create a new MySQL database. Under networking options, keep TLS and External Access disabled. You can start with the
nf-compute-20
plan with 4GB of storage and one replica.Create a new secret group which will store the environment variables and build arguments. We will add both manual and inherited secrets. Inherited secrets come from the MySQL database we created earlier.
Manual Secrets
Key Value WORDPRESS_DB_HOST
${HOST}:${PORT}
- Secret templating enables developers to generate environment variables from defined variables and inherited secrets from managed databases. Read more about them in our changelog.
Inherited Environment Variables
- The values for the alias were found on the official site of WordPress’s Docker Image.
Variable name Alias host
HOST
port
PORT
username
WORDPRESS_DB_USER
password
WORDPRESS_DB_PASSWORD
database
WORDPRESS_DB_NAME
- Inheriting environment variables ensures that the database connection details are automatically injected in the environment, avoiding the need to manually copy and paste them.
Create a deployment service. Choose external image as deployment source and the image path will be
library/wordpress:latest
from Docker Hub. By default port 80 will be publicly exposed with the HTTP protocol. The smallest resource plannf-compute-10
will be enough to get you started.To store the media you will add to the WordPress site you will have to configure volumes. Inside of your service navigate to Volumes and add a new volume. Choose the name, storage and set the container path to
/var/www/html
. Save the volume, which will rollout a restart.- Volumes are great for persisting data across service restarts. To learn more about them, read our changelog post.
Once the restart is finished, go to the service URL where you will be prompted to create a Wordpress account and configure your site. Happy blogging!
Northflank allows you to deploy your code and databases within minutes. Sign up for a Northflank account and create a free project to get started.
- Multiple read and write replicas
- Observe & monitor with real-time metrics & logs
- Low latency and high performance
- Backup, restore and fork databases
- Private and optional public load balancing as well as Northflank local proxy