Install ClassicPress on VPS with Caddy Server

This guide will walk you through setting up ClassicPress on VPS with Caddy Server. We will assume you have a basic understanding of the command line.

Introduction

In this post, we will discuss the steps to install ClassicPress Content Management System on a VPS using Caddy Server. We will assume the VPS has Debian12 Linux, and  has already configured the server with SSH access and a firewall like UFW or fail2ban. We will use ClassicPress version 2 in this install.

The below steps should also be similar if you use Ubuntu 22.04 instead of Debian12.

[modula id=”641″]

Installing ClassicPress on VPS with Caddy Server

Below are the steps to follow in order to install ClassicPress on VPS with Caddy Server:

As a first step, log on to your VPS using ssh. The user should have sudo privileges.

How to install ClassicPress on Caddy Server

1. Update and Upgrade System:

Start by updating the package list and upgrading existing packages to ensure you have the latest versions:

sudo apt update && sudo apt upgrade -y

2. Install Required Packages:

Install the necessary packages for ClassicPress, including PHP, MariaDB, and unzip:

sudo apt install php php-fpm php-mysql mariadb-server unzip -y

3. Configure MariaDB:

Secure your MariaDB installation and create a database and user for ClassicPress:

sudo mysql_secure_installation

Follow the prompts to set a root password, remove anonymous users, disable remote root login, and remove test databases.

Then, log in to the MariaDB shell:

sudo mysql -u root -p

Create a database and user for ClassicPress:

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

4. Install Caddy Server:

Download and install Caddy Server using the official script:

curl https://getcaddy.com | bash -s personal

5. Configure Caddyfile:

Create a Caddyfile in the /etc/caddy/ directory with the following content:

your_domain.com {
    root * /var/www/classicpress
    php_fastcgi unix//run/php/php8.1-fpm.sock
    file_server
}

Replace your_domain.com with your actual domain name.

6. Download and Extract ClassicPress:

Download the latest ClassicPress zip file and extract it to the webroot directory:

cd /var/www
wget https://classicpress.net/latest-classicpress.zip
unzip latest-classicpress.zip
mv classicpress/* .
rmdir classicpress

7. Set Permissions:

Ensure proper ownership and permissions for the webroot directory:

sudo chown -R www-data:www-data /var/www/classicpress
sudo chmod -R 755 /var/www/classicpress

8. Configure ClassicPress:

Navigate to your domain in a web browser and follow the ClassicPress installation wizard. Provide the database details you created earlier and set up your admin account.

9. Start Caddy Server:

Start Caddy Server and enable it to run on system startup:

sudo systemctl start caddy
sudo systemctl enable caddy

10. Configure Firewall (Optional):

If you’re using UFW, open ports 80 and 443 for HTTP and HTTPS traffic:

sudo ufw allow 80
sudo ufw allow 443

11. Secure Your Site (Optional):

Consider obtaining an SSL certificate for your domain and configuring HTTPS in your Caddyfile for secure connections.

Your ClassicPress installation on VPS with Caddy server should now be complete.

Install ClassicPress on VPS with Caddy Server. Blog of Amar Vyas

Advantages and limitations of Caddy Server

Below you will find a short comparison of Caddy, Nginx, and Apache2 to help you make an informed decision:

Caddy Server

Pros:

  • Simplicity: Caddy boasts a user-friendly configuration with its Caddyfile format, making it easy to set up and manage, even for beginners.
  • Automatic HTTPS: Caddy automatically obtains and renews SSL certificates from Let’s Encrypt, ensuring secure connections without manual intervention.
  • Performance: While not as widely used as Nginx, Caddy offers competitive performance for most ClassicPress sites.
  • Modern Features: Caddy supports HTTP/2, HTTP/3, and other modern web technologies out of the box.

Cons:

  • Smaller Community: Compared to Nginx and Apache2, Caddy has a smaller community, which may result in fewer resources and support options.
  • Limited Flexibility: While Caddy’s simplicity is a strength, it may lack the extensive customization options available in Nginx and Apache2.

For simplicity and ease of use, Caddy is an excellent choice, especially for beginners or those who prioritize automatic HTTPS.


This post titled ClassicPress on VPS with Caddy Server was published under the category installation of ClassicPress
All content on this site, except explicitly attributed, is released under Creative Commons NonCommerical License . Learn more about CC BY-NC License