To register a new account on this wiki, contact us

Caddy

From FSCI Wiki
Jump to navigation Jump to search

Caddy is a server software (like nginx, apache) that has automatic provisioning of https certificates built-in. It is used on several FSCI servers.

Features

  • Useful default values (for example, php_fastcgi directive by default redirects requests to index.php, reverse_proxy directive by default sets X-Forwarded-* headers, file_server directive by default enforces canonical URLs, etc)
  • Automatically generates and rotates TLS certificates (using Let's Encrypt)

Common configurations

PHP sites

 example.com {
     root /var/www/example.com
     php_fastcgi unix//var/run/php/php-fpm.sock
     file_server
 }

Reverse Proxy

example.com {
    reverse_proxy localhost:8080
}

Simple HTML with logging to file

example.com {
    root /var/www/example.com
    file_server
    log {
        output file /var/log/caddy/example.com
    }
}

Typical workflow

# edit the configuration
sudo -e /etc/caddy/Caddyfile

# ask caddy to reload configuration
sudo systemctl reload caddy


# check status and logs
sudo systemctl status caddy
sudo journalctl -u caddy