Article

Table of Contents
Try Vultr Today with

$50 Free on Us!

How To Install Caddy on Linux

Published on: Sat, Dec 19, 2015 at 3:47 pm EST
Linux Guides Server Apps Web Servers

Caddy is a web server that allows HTTP/2. It is a full-featured web server that includes the ability to enable HTTPS automatically. This allows for web server creation with high flexibility and low overhead.

My article will show you how to download and setup the Caddy web server. Please note that this article is meant for 64-bit servers, however it should work with 32-bit as well.

Step 1: Download and install Caddy

Download and install the latest version of Caddy by running the following command:

curl https://getcaddy.com | bash

This will download Caddy which only includes Caddy core. No additional add-ons will be included in this download. Some Caddy add-ons are git, cors, and hugo.

Step 2: Using Caddy

Caddy is an easy-to-use web server. First, create an index.html file and populate it with the following content:

<!doctype html>
<html>
    <head>
        <title> Hello World </title>
    </head>
    <body>
        <p>Hello world!</p>
    </body>
</html>

Once done, run caddy in the same directory. If your website is located elsewhere, run /path/to/caddy root="/path/to/website".

Next, go to your browser and navigate to http://0.0.0.0:2015/index.html. You will see a page that reads Hello world!.

If you would like to change the port of the server or make it the default HTTP port, run caddy -port=80. Remember that running Caddy with port 1024 or lower requires root privileges.

Want to contribute ?

You could earn up to $300 by adding new articles