In this tutorial, we will show you how to install the Caddy on CentOS 8. For those of you who didn’t know, The Caddy web server is an open-source web server written in Go. It is designed around simplicity and security that comes with a number of features that are useful for hosting websites. Caddy has been designed to support all popular platforms that’s why it is available for Windows, macOS, Linux, BSD, Android, Solaris, 32-bit, x64, ARM, mips64, and more.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘
sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the Caddy web server on CentOS 8.
- A server running one of the following operating systems: CentOS 8.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- SSH access to the server (or just open Terminal if you’re on a desktop).
non-root sudo useror access to the
root user. We recommend acting as a
non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.
Install Caddy on CentOS 8
Step 1. First, let’s start by ensuring your system is up-to-date.
sudo dnf update sudo dnf install epel-release
Step 2. Installing 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 commands below can be used to stop, start and enable the Caddy service to automatically start up when the server boots:
sudo systemctl start caddy sudo systemctl enable caddy
You can verify the installation by the following command:
$ caddy version v2.4.3 h1:Y1FaV2N4WO3rBmeilanaUZsZTQdN+PwcoOcAiZTM8C0I=
Step 3. Configure Firewall.
Assuming that you are using a firewalld as your server’s firewall, run the following command to add the HTTP and HTTPS ports in 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. Accessing Caddy web server.
Once successfully installed, now navigate to your browser and enter your server IP or domain name:
Congratulations! You have successfully installed Caddy. Thanks for using this tutorial for installing the Caddy web server on your CentOS 8 system. For additional help or useful information, we recommend you to check the official Caddy website.