Configuring Server Environment for WordPress Blog

Debain 11.1

Php 7.4.25

apt-get install php7.4

apt-get install php7.4-fpm php7.4-cgi php7.4-curl php7.4-gd php7.4-xml php7.4-xmlrpc php7.4-mysql php7.4-bz2 php7.4-bcmath php7.4-gmp php7.4-mbstring php7.4-readline php7.4-zip

APT will by default install an older version of Nginx.

Nginx 1.18.0

apt-get install nginx

systemctl start nginx

Nginx

Adding Official Nginx Repository

vim /etc/apt/sources.list
deb http://nginx.org/packages/mainline/ubuntu/ focal nginx
deb-src http://nginx.org/packages/mainline/ubuntu/ focal nginx

Importing Nginx Public Key

wget http://nginx.org/keys/nginx_signing.key

apt-key add nginx_signing.key

Checking Available Versions

apt-cache madison nginx

apt-get install nginx

systemctl start nginx

MariaDB 10.5.12

apt-get install mariadb-server

MariaDB

Security Configuration

mysql_secure_installation

Creating Database

Logging In
mysql -u root -p
Creating User
create user 'user_wordpress'@'localhost' identified by 'yourpassword';
Creating WordPress Database
create database db_wordpress default charset utf8 collate utf8_general_ci;
Granting Permissions to New User
grant all privileges on db_wordpress.* to 'user_wordpress'@'localhost' identified by 'yourpassword';

flush privileges;
Exiting
exit;

Basic Test

Testing Nginx and PHP Environment

Creating Root Directory and Changing Owner and Group

cd  /var/www/html/
mkdir wordpress
chown -R www-data.www-data wordpress/

Creating a phpinfo File for Testing

<?php phpinfo(); ?>

Installing and Configuring WordPress

Download and extract to the WordPress folder.

Enter the domain name or IP address to complete the setup.