How to install Caddy on CentOS 8

In this tutorial we will show you how to install Caddy on CentOS 8. For those of you who did not know, the Caddy web server is an open source server written in Go.

It is designed around simplicity and security that comes with a number of features that are useful for web hosting. Caddy is designed to support all popular platforms and that is why it is available for Windows, macOS, Linux, BSD, Android, Solaris, 32-bit, x64, ARM, mips64 and more.

This article assumes that you have at least basic knowledge of Linux, know how to use the shell and most importantly, that you host your website on your own VPS. The installation is quite simple and requires you to run in the root account, otherwise you may need to add ‘sudoto the commands for root privileges. I will show you step by step installation of the Caddy web server on a CentOS 8.

Install Caddy on CentOS 8

Step 1. Let’s first start by making sure your system is up to date.

sudo dnf update
sudo dnf install epel-release

Step 2. Install Cady on CentOS 8.

Now run the following command below to install Cady Web servers:

sudo dnf install ‘dnf-command(copr)’
sudo dnf copr enable @caddy/caddy
sudo dnf install caddy

After installing Caddy, the following commands can be used to stop, start, and enable the Caddy service to start automatically when the server starts:

sudo systemctl start caddy
sudo systemctl enable caddy

Step 3. Configure firewall.

Assuming you use a firewall as the server’s firewall, run the following command to add the HTTP and HTTPS ports to the firewall.

sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --permanent --zone=public --add-service=https
sudo firewall-cmd --reload

Step 4. Access the Caddy Web Server.

Once installed, navigate to your browser and enter the server’s IP or domain name:

http://your-domain-name.com

Congratulations! You have installed Caddy. Thank you for using this guide to install the Caddy Web Server on your CentOS 8 system. For further help or useful information, we recommend that you check the official Caddy website.