One place for hosting & domains

      Install Caddy on Arch Linux


      Updated by Linode

      Contributed by

      Claudio Costa

      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.

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

      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.

      Find answers, ask questions, and help others.

      This guide is published under a CC BY-ND 4.0 license.



      Source link