Install Caddy on Arch Linux
Updated by Linode Contributed by Claudio Costa
Before You Begin
Familiarize yourself with our Getting Started guide and complete the steps for setting your Linode’s hostname and timezone.
This guide will use
sudo
wherever possible. Complete the sections of our Securing Your Server guide to create a standard user account, harden SSH access and remove unnecessary network services.You will need to register your site’s domain name and follow our DNS Manager Overview guide to point your domain to your Linode.
Update your system with
sudo pacman -Syu
Install the development package group with
sudo pacman -S base-devel
What is Caddy?
Caddy is an open source HTTP/2 capable web server with automatic HTTPS written in Go. It supports a variety of web site technologies, includes security defaults, and is very easy to use.
Install Caddy
You can install Caddy on Arch Linux by using a snapshot from the Arch User Repository (AUR).
Download the snapshot from the AUR:
curl https://aur.archlinux.org/cgit/aur.git/snapshot/caddy.tar.gz -o caddy.tar.gz
Unpack the snapshot:
tar xf caddy.tar.gz
Navigate to the
caddy
directory:cd caddy
Build and install the package:
makepkg -si
Test Caddy
Start the Caddy web server:
sudo systemctl start caddy
Enable the Caddy service:
sudo systemctl enable caddy
Navigate to your Linode’s domain name or IP address in a web browser. You should see the Caddy default page displayed.
Configure Caddy
Caddy configuration files reside in /etc/caddy/
and website configuration files should be created in the /etc/caddy/caddy.conf.d/
directory.
Create a sample configuration file for your website. Replace
example.com
with your Linode’s domain name. If you have not set up a domain, but still want to get started with Caddy, replaceexample.com
with:80
.- /etc/caddy/caddy.conf.d/example.com.conf
-
1 2 3
example.com { root /usr/share/caddy/ }
Note
If you choose to serve your site from a directory other than/usr/share/caddy/
, you must remove the Caddy test site files located in that directory. The/usr/share/caddy/
directory is prioritized over other locations, so any files stored in that directory will be served first, even if you have configured a different directory location.Reload Caddy:
sudo systemctl reload caddy
Navigate to your Linode’s domain name in a web browser. You should be able to see content served from the root directory configured above.
More Information
You may wish to consult the following resources for additional information on this topic. While these are provided in the hope that they will be useful, please note that we cannot vouch for the accuracy or timeliness of externally hosted materials.
Join our Community
Find answers, ask questions, and help others.
This guide is published under a CC BY-ND 4.0 license.