March 16, 2025
Categories: Notes398 words

The CLMP stack

Instead of the regular LAMP (Linux, Apache, MySQL, PHP) stack, we’ll be swapping out the Apache webserver with Caddy.

Why Caddy? Caddy is my go-to choice for web servers. What makes it stand out is its automatic HTTPS setup, straightforward configuration, and modern protocol support like HTTP/3. While it’s easier to set up than NGINX or Apache, Caddy tends to use more resources and has a smaller ecosystem. It’s great for WordPress and small-to-medium projects, but for high-traffic sites or complex configurations, NGINX or Apache may be a better fit. However, for small projects like this, it would be a great choice.

Procedure

Step 1: Install Mysql

Start by updating your package lists and installing MySQL:

Copy to Clipboard


Secure your installation with:

Copy to Clipboard

Then log in to MySQL:

Copy to Clipboard

Create a database for WordPress:

Copy to Clipboard

Remember to replace ‘wordpressuser‘ with your username and ‘password’ with your password. Take note of the username, password, and your host (localhost) as this will be entered once more when WordPress configuration begins.

Step 2: Install PHP

WordPress requires PHP, so install PHP and its required modules:

Copy to Clipboard

Step 3: Install Caddy

Caddy is a powerful web server that automatically manages SSL certificates. Install it with these commands:

Copy to Clipboard

Step 4: Download and extract WordPress

Navigate to the web root directory and download WordPress:

Copy to Clipboard

Step 5: Configure DNS

Log into your domain registrar and add an ‘A’ record pointing your domain to your server’s IP address:

  • Name: @ for root domain or www for subdomain
  • Type: A
  • TTL: 1 hour or default
  • Value: Your server’s public IP address

Step 6: Configure Caddy for WordPress

Edit Caddy’s configuration file (/etc/caddy/Caddyfile):

Copy to Clipboard


Modify the Caddyfile contents:

Copy to Clipboard

In this configuration, replace yourdomain.com with your actual domain or IP address. At the time of writing, the php-fpm version is 7.4. Check your php-fpm version in the /run/php directory and modify the configuration to match your php-fpm version.

Step 7: Start and Enable Caddy

Enable and start Caddy to ensure it runs on boot:

Copy to Clipboard

Step 8: Finalize WordPress Setup

Open your browser and visit http://yourdomain.com to complete the WordPress setup process.

Final Notes

This tutorial covers only the setup of the CLMP stack. Further configuration of WordPress should follow and the credentials for the database we setup earlier will need to be entered once more. After that, the rest of the steps will be straightforward and you’ll have your own instance of WordPress attached to your custom domain.