In this tutorial, How to install Caddy on Ubuntu.
The Caddy web server is an open-source web server written in Go. It is designed around simplicity and security that comes with a number of features that are useful for hosting websites. Caddy is both a flexible, efficient static file server and a powerful, scalable reverse proxy.
Prerequisites
- A Ubuntu OS.
- A root user access or normal user with administrative privileges.
1. Update your system
# apt update -y && apt upgrade -y
2. Install Caddy
# curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo apt-key add -
# curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee -a /etc/apt/sources.list.d/caddy-stable.list
# apt update
After install Caddy on Ubuntu server.
# apt install caddy
3. Open your browser and enter your server IP or domain name:
http://Server-IP
OR
http://yourdomain.com
4. Configure Domain with Caddy
Create a directory for your website files
# mkdir -p /var/www/html/huuphan.com
(Optinal) if you are using SELinux than you need to change the file security context for web content.
# chcon -t httpd_sys_content_t /var/www/html/huuphan.com -RFor example, open Caddy’s configuration file and config for your domain.
# chcon -t httpd_sys_rw_content_t /var/www/html/huuphan.com -R
# vi /etc/caddy/CaddyfileReplace :80 with your domain name and change the site root to /var/www/html/huuphan.com
as the picture below
Restart Caddy server
# systemctl reload caddy
Thanks for reading How to Install Caddy on Ubuntu My blog Zimbra Mail Server,linux,bash script,centos,linux command I hope this is useful.