Caddy is a general purpose web server alternative to apache server. It is easy to use and configure. It is the only first web server that acquires and renews SSL/TLS certificate automatically using Let's Encrypt.
Features of Caddy:
- Speedy HTTPS request
- Least configuration required and hassle free deployment
- No dependency on any platform
- No installation required
- Run on multiple CPUs/Cores
- Full support for the latest IPV6
- Serve FastCGI, Reverse Proxy, Rewrite and Redirects, Clean URL, Gzip compression, Directory Browsing, Virtual Hosts, and Headers.
- Available for Platforms such as Windows, Linux,BSD, Mac, Android.
STEPS TO INSTALL CADDY IN FEDORA, REDHAT, CENTOS:
# dnf install 'dnf-command(copr)' # dnf copr enable @caddy/caddy # dnf install caddy
On Redhat/CentOS 7:
# yum install yum-plugin-copr # yum copr enable @caddy/caddy # yum install caddy
STEPS TO INSTALL CADDY IN DEBIAN AND UBUNTU:
$ echo "deb [trusted=yes] https://apt.fury.io/caddy/ /" \ | sudo tee -a /etc/apt/sources.list.d/caddy-fury.list $ sudo apt update $ sudo apt install caddy
Upon successful installation of Caddy, we can check the status, start and enable the service using the following commands:
# systemctl start caddy # systemctl enable caddy # systemctl status caddy
Open the browser and point it to the following address:
http://Server-IP
OR
http://yourdomain.com
STEPS TO SET UP DOMAINS WITH CADDY:
1] Point your domains A/AAAA DNS records at this server in your DNS control panel.
2] Create a document root directory for your website under folder /var/www/html using the following command
$ mkdir /var/www/html/abc.com
3] If SELinux is being used,then change the file security context for web content by using the below command
# chcon -t httpd_sys_content_t /var/www/html/abc.com -R
# chcon -t httpd_sys_rw_content_t /var/www/html/abc.com -R
4] Open and edit caddy configuration file at /etc/caddy/Caddyfile
vim /etc/caddy/Caddyfile
5] Replace :80
with your domain name and change the site root to /var/www/html/abc.com.
6] Reload Caddy to save the configuration change using the following command:
systemctl reload caddy
7] Create any HTML page and save it under document root directory for your website.
touch /var/www/html/example.com/index.html
8] Add the following sample Html code to your website’s index page.
echo '<!doctype html><head><title>Caddy Test Page at Rootadminz</title></head><body><h1>Hello, World!</h1></body></html>' | sudo tee /var/www/html/index.html
9] Visit the site again to see the page.
Upon successful configuration, the domain will be accompanied by HTTPS protocol assuring secure connection.