Install Caddy on Arch Linux

Updated , by Claudio Costa

Traducciones al Español
Estamos traduciendo nuestros guías y tutoriales al Español. Es posible que usted esté viendo una traducción generada automáticamente. Estamos trabajando con traductores profesionales para verificar las traducciones de nuestro sitio web. Este proyecto es un trabajo en curso.
Try this guide to receive $100 at signup on a new account.

Before You Begin

  1. Familiarize yourself with our Getting Started guide and complete the steps for setting your Linode’s hostname and timezone.

  2. 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.

  3. You will need to register your site’s domain name and follow our DNS Manager Overview guide to point your domain to your Linode.

  4. Update your system with sudo pacman -Syu

  5. 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).

  1. Download the snapshot from the AUR:

     curl https://aur.archlinux.org/cgit/aur.git/snapshot/caddy.tar.gz -o caddy.tar.gz
    
  2. Unpack the snapshot:

     tar xf caddy.tar.gz
    
  3. Navigate to the caddy directory:

     cd caddy
    
  4. Build and install the package:

     makepkg -si
    

Test Caddy

  1. Start the Caddy web server:

     sudo systemctl start caddy
    
  2. Enable the Caddy service:

     sudo systemctl enable caddy
    
  3. 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.

  1. 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, replace example.com with :80.

    File: /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.
  2. Reload Caddy:

     sudo systemctl reload caddy
    
  3. 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.

This page was originally published on


Your Feedback Is Important

Let us know if this guide made it easy to get the answer you needed.