How To Install Caddy on CentOS 7

To Install Caddy on Centos 7

Caddy is an open source HTTP Web server that used for various platforms including Windows, Mac, Linux, FreeBSD, OpenBSD, etc. It is a full featured HTTP/2 web server which can be automatically enables the HTTPS. It allows the designers to create amazing things with high flexibility and low overhead. This article will show you how to install Caddy on CentOS 7.

Features

  • Automatic HTTPS
  • Easy Deployment
  • Multi-core
  • WebSockets
  • Rewrites & Redirects
  • Virtual Hosts

Installation Procedure

Download the caddy package from its offciail website, which is suitable for your distribution.

[root@linuxhelp ~]# wget https://caddyserver.com/download/builds/173003001257928/caddy_linux_amd64_custom.tar.gz

--2017-04-01 02:30:12--  https://caddyserver.com/download/builds/173003001257928/caddy_linux_amd64_custom.tar.gz
Resolving caddyserver.com (caddyserver.com)... 162.243.142.63, 2604:a880:1:20::8c:3001
Connecting to caddyserver.com
.
.
.
Saving to: ‘ caddy_linux_amd64_custom.tar.gz’ 

100%[==========================================================================================================================================> ] 49,97,180    142KB/s   in 54s   

2017-04-01 02:31:07 (90.0 KB/s) - ‘ caddy_linux_amd64_custom.tar.gz’  saved [4997180/4997180]

[root@linuxhelp ~]# ls
anaconda-ks.cfg  caddy_linux_amd64_custom.tar.gz  Desktop  Documents  Downloads  initial-setup-ks.cfg  Music  Pictures  Public  Templates  Videos

Once the package is downloaded, create a new directory for caddy.

[root@linuxhelp ~]# mkdir caddy

Move the package to the newly created directory.

[root@linuxhelp ~]# mv caddy_linux_amd64_custom.tar.gz caddy
[root@linuxhelp ~]# ls
anaconda-ks.cfg  caddy  Desktop  Documents  Downloads  initial-setup-ks.cfg  Music  Pictures  Public  Templates  Videos
[root@linuxhelp ~]# cd caddy/
[root@linuxhelp caddy]# ls
caddy_linux_amd64_custom.tar.gz

Extract the downloaded package with the tar command.

[root@linuxhelp caddy]# tar -xzvf caddy_linux_amd64_custom.tar.gz
README.txt
LICENSES.txt
CHANGES.txt
init/
init/README.md
init/freebsd/
init/freebsd/caddy
init/linux-systemd/
init/linux-systemd/README.md
init/linux-systemd/caddy.service
init/linux-sysvinit/
init/linux-sysvinit/README.md
init/linux-sysvinit/caddy
init/linux-upstart/
init/linux-upstart/README.md
init/linux-upstart/caddy.conf
init/linux-upstart/caddy.conf.centos-6
init/linux-upstart/caddy.conf.ubuntu-12.04
init/mac-launchd/
init/mac-launchd/README.md
init/mac-launchd/com.caddyserver.web.plist
caddy

Create index.html file in caddy’ s directory.

[root@linuxhelp caddy]# ls
caddy  caddy_linux_amd64_custom.tar.gz  CHANGES.txt  init  LICENSES.txt  README.txt
[root@linuxhelp caddy]# vim index.html

Generally, default index page is required to run the web server.

Enter some text into the index file.

< !doctype html> 
< html> 
    < head> 
        < title>  Caddy Webserver < /title> 
    < /head> 
    < body> 
        < p> Caddy Webserver!< /p> 
    < /body> 
< /html> 

Run the script file to start the caddy web server.

[root@linuxhelp caddy]# ./caddy
Activating privacy features... done.
http://:2015

Finally open the web browser and call the link http://0.0.0.0:2015, caddy' s default port number.

Here you can view the content given in the index file.

Wasn' t that an easy installation procedure?. Caddy is a full featured HTTP/2 web server that can run on Windows, Mac, Linux, FreeBSD, OpenBSD platforms.

FAQ
Q
Is Caddy Opensource?
A
Caddy is an open source and free software.
Q
What is Caddy software?
A
Caddy is an open source HTTP Web server that used for various platforms including Windows, Mac, Linux, FreeBSD, OpenBSD, etc. It is a full-featured HTTP/2 web server which can automatically enable the HTTPS.
Q
Does Caddy has WebSocket availability function?
A
Caddy does provide WebSocket connectivity.
Q
Does Caddy have redirects?
A
Yes Caddy do provide Rewrites & Redirects
Q
./caddy script got executed successfully, but the web page is not getting accessed?
A
The custom port access for Caddy should be added and enabled in the firewall.