How to configure and install the Caddy Web server on AlmaLinux 8

0

This tutorial is about configuring and installing the Caddy Web Server on AlmaLinux 8. We will do our best to make sure you understand this guide. I hope you will like this blog How to configure and install the Caddy Web server on AlmaLinux 8. If your answer is yes, please share after reading this.

Check How to Configure and Install the Caddy Web Server on AlmaLinux 8

In this tutorial, we’ll show you how to install Caddy on AlmaLinux 8. For those of you who didn’t know, Caddy is a powerful, enterprise-grade open source web server with automatic HTTPS written in Go. ‘a lightweight, commercially supported web server that can automatically acquire and renew SSL / TLS certificates with Let’s Encrypt. This guide assumes that you have at least a basic working knowledge of Linux, how to use the Shell, and most importantly, that you are hosting your site on your own VPS.

Installation is fairly straightforward and assumes you are using the root account. Otherwise, you may need to add “sudo” to the commands to gain root privileges. I will show you step by step how to install the Caddy web server on AlmaLinux 8. You can follow the same instructions for CentOS and Rocky Linux.

Install Caddy Web Server on RockyLinux 8 / AlmaLinux 8 / CentOS 8

The installation of the Caddy web server is very simple, but first we need to update the operating system.

After that we can install Caddy by activating a special repository with these two commands.

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

You can now install Caddy by running

You can check the installed version with the command:

    • cart version
    • v2.4.3 h1: Y1FaV2N4WO3rBqxSYA8UZsZTQdN + PwcoOcAiZTM8C0I =

Configuring the Caddy Web Server

You normally have a firewall running, so you need to enable ports 80 and 443 on it. Now at the system level you can do this using these commands:

    • sudo firewall-cmd –permanent –add-service = http
    • sudo firewall-cmd –permanent –add-service = https

And to apply the changes, restart the firewall.

    • sudo systemctl reload firewalld

After that you need to activate and start the Caddy service

    • sudo systemctl enable – now caddy

Then you can check the status of the service. Now yes, open a web browser you trust and navigate to http: your-server. The Caddy Web server is therefore operational.

Creation of a new site on the Caddy web server

This step is the equivalent of VirtualHost on Apache or ServerBlock on Nginx. So, create the directory dedicated to your site.

    • sudo mkdir -p /var/www/osradar.test/html

In my case, I called it osradar.test but you can call it whatever you want. Also create a directory dedicated to logs.

    • sudo mkdir / var / log / caddy

Make the user caddy the owner of both folders.

    • caddy sudo chown: caddy /var/www/osradar.test/html -R
    • caddy sudo chown: caddy / var / log / caddy

Now create an index.html file in your new site directory.

    • sudo nano /var/www/osradar.test/html/index.html

And add code. Save your changes and close the editor. Now in the main Caddy config file. Save the changes. Validate the configuration file

    • Caddy validate –adapter caddyfile –config / etc / caddy / Caddyfile

If the output to the screen generates a warning, you can correct it by running

    • caddy fmt – overwrite / etc / caddy / Caddyfile

To apply the changes, restart the Caddy service.

    • sudo systemctl restart cart

Final words: How to configure and install the Caddy Web server on AlmaLinux 8

hope you will understand this item How to configure and install the Caddy Web server on AlmaLinux 8, if your answer is no, you can request anything through the contact forum section linked to this article. And if your answer is yes, then share this article with your family and friends.


Source link

Share.

About Author

Comments are closed.