ClassicPress Installation with LEMP Stack Debian12 VPS

In this post, we will learn about ClassicPress Installation with LEMP Stack. That is, installing Nginx server, mysql and PHP on a server that has Debian 12 Linux installed. Installing a web server, PHP and mysql are pre requisites to use WP-CLI for installing ClassicPress.

Introduction

For purposes of this post we will consider a fresh install of Debian (or Ubuntu) Linux on a Virtual Private Server or VPS. Installation methods for other Linux distributions may be similar, or may vary as mentioned in the documentation for that distribution.

For Beginners

For beginners, using a control panel like HestiaCP or ServerAvatar is likely the easiest approach. These control panels provide a user-friendly web interface to manage the server and install applications like ClassicPress with just a few clicks. This avoids the need to manually configure the web server, database, and other prerequisites.

Alternatively, some shared hosting providers offer easy 1-click installers for ClassicPress through tools like Softaculous in their control panels. This is also a beginner-friendly option that handles the technical setup automatically.

ClassicPress Installation with LEMP Stack

For Intermediate Users

Intermediate users who are comfortable with the command line can consider using WP-CLI to install and manage ClassicPress. WP-CLI provides a powerful way to automate many aspects of a ClassicPress site.

However, before using WP-CLI, the various server prerequisites like the web server (Nginx or Apache), PHP, and database (MySQL/MariaDB) need to be properly installed and configured. This does require more technical knowledge compared to using a control panel.

Another option for intermediate users is to use server management tools like WordOps or Webinoly. These tools help automate the server setup and can install WordPress which can then be converted to ClassicPress using the migration plugin.

Maintenance and Updates

Regardless of the initial installation method, WP-CLI is very useful for ongoing maintenance and updates of a ClassicPress site. It allows performing many administrative tasks from the command line.

There are also some plugins and tools like MainWP that aim to provide a dashboard to manage multiple ClassicPress sites. These can simplify maintenance for users managing several sites.

ClassicPress Installation with LEMP Stack

Check if WebServer PHP and mysql is installed

WP-CLI is a command-line tool for managing WordPress and ClassicPress installations, but it doesn’t include the necessary server components. some Linux installations may have PHP and server apache installed as a part of the server packages.

How to check if your VPS already ahs web server, PHP and / or mysql database installed

To check if your Linux VPS has MariaDB, PHP, Apache2, or Nginx installed, you can use the following commands:

  1. Check for MariaDB:
    sudo systemctl status mariadb
    

    If MariaDB is installed and running, you will see output indicating the service status as “active (running)”.

  2. Check for PHP:
    php -v
    

    If PHP is installed, this command will display the PHP version and other details.

  3. Check for Apache2:
    sudo systemctl status apache2
    

    If Apache2 is installed and running, you will see output indicating the service status as “active (running)”.

  4. Check for Nginx:
    sudo systemctl status nginx
    

    If Nginx is installed and running, you will see output indicating the service status as “active (running)”.

Additionally, you can check for the presence of configuration files and directories specific to each service:

  • MariaDB: Check for the directory /etc/mysql or /etc/mariadb.
  • PHP: Check for the directory /etc/php or /etc/php/.
  • Apache2: Check for the directory /etc/apache2.
  • Nginx: Check for the directory /etc/nginx.

If the respective directories exist, it indicates that the corresponding service is likely installed on your system.

You can also use the which command to locate the executable files for each service:

which mysqld
which php
which apache2
which nginx

If the command returns a path, it means the corresponding executable is installed and available in the system’s PATH.

Install webserver PHP and mysql on Debian


Install webserver PHP and mysql on Debian 12 VPS

1. Web Server (Nginx)

Install Nginx on your server by running the following commands:

sudo apt update
sudo apt install nginx

Create an Nginx configuration file for ClassicPress:

sudo nano /etc/nginx/sites-available/classicpress

Add the following content to the configuration file:

server {
    listen 80;
    listen [::]:80;
    listen 443 ssl;
    listen [::]:443 ssl;
    server_name your_domain;
    root /var/www/classicpress;
    index index.php;

    ssl_certificate /path/to/your/certificate.crt;
    ssl_certificate_key /path/to/your/certificate.key;

    location / {
        try_files $uri $uri/ /index.php?$args;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php8.0-fpm.sock;
    }
}

Replace your_domain with your actual domain name.

Enable the ClassicPress site and restart Nginx:

sudo ln -s /etc/nginx/sites-available/classicpress /etc/nginx/sites-enabled/
sudo systemctl restart nginx
2. Database Server (MySQL)

Install MySQL server and secure the installation:

sudo apt install mysql-server
sudo mysql_secure_installation

Follow the prompts to set a root password and configure the security settings.

Create a new MySQL database and user for ClassicPress:

sudo mysql -u root -p

Enter the MySQL root password, then run the following commands:

CREATE DATABASE classicpress;
CREATE USER 'cpuser'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON classicpress.* TO 'cpuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Replace your_password with a strong password.

3. PHP

Install PHP and the required modules:

sudo apt install php libapache2-mod-php php-mysql php-curl php-gd php-mbstring php-xml php-xmlrpc php-soap php-intl php-zip

Note:
if you don’t need Apache2 and are only using Nginx, then give the below command:

sudo apt install php-fpm php-mysql php-curl php-gd php-mbstring php-xml php-xmlrpc php-soap php-intl php-zip

The libapache2-mod-php package is not needed since you are using Nginx instead of Apache2. Replace it with the php-fpm package, which is required for running PHP with Nginx.

After installing these prerequisites, you can proceed with installing WP-CLI and setting up ClassicPress Installation with LEMP Stack .

Note: Make sure to obtain and configure a valid SSL/TLS certificate for your domain to enable HTTPS. You can use Let’s Encrypt with Certbot to get a free SSL/TLS certificate.

Tanjore style painting showing a woman looking at a ClassicPress Installation with LEMP Stack


This post about ClassicPress Installation with LEMP Stack was published under the category classicpress installation.

All content on this site, except explicitly attributed, is released under Creative Commons NonCommerical License . Learn more about CC BY-NC License