This how-to explains the necessary steps to install WordPress, the popular blogging platform, on your own CentOS 7 server. Hosting WordPress yourself can have several advantages: It gives you full control over your setup, your learn something and in my case it also led to significant improvements in speed and responsiveness of my page.
When I tried to install WordPress on a CentOS 7 server myself, I discovered that many of the how-tos available on the Internet were either outdated or led to configuration issues. Some tutorials were also outright insecure. Therefore I decided to write a blog entry that sums it all up and leads to a reasonably secure and also performant web server for WordPress.
Overview: Install and configure Nginx, PHP, MySQL/MariaDB and SELinux on CentOS 7 to run WordPress
This guide will cover the following topics, which is basically setting up a LEMP-stack (=Linux, Nginx, MySQL, PHP) plus WordPress. In the end some thoughts on performance tuning and security will be given.
Overview and links to the different parts of this blog entry:
How to install Nginx, the webserver
How to install MariaDB, a MySQL database
How to create a database in MySQL/MariaDB for WordPress
How to install PHP
How to configure Nginx for WordPress
How to install WordPress
How to configure SELinux to make it work with WordPress
How to install phpMyAdmin and secure it to manage the database
Performance and security tweaks for your setup
This guide is for CentOS 7, but it should also work wit Redhat Enterprise Linux RHEL 7. In addition, Fedora Linux should be similar as well.
In the future I will also include how to set up SSL for your server. That being said, this guide comes with no warranty. Feel free to comment below if you have feedback.
The prerequisites are that you have a server with CentOS 7 installed. The initial server setup is explained very well in this guide.
Installation of NGINX
To install Nginx, you have to activate the Centos 7 EPEL repository:
sudo yum install epel-release