Huu Phan | Blog Linux operating system | Linux operating system -Blog Huu Phan | www.huuphan.com
huuphan.com. Powered by Blogger.

My blog about Open Source: Zimbra Mail Server,linux,bash script,centos,linux command...

How to Install Caddy on Ubuntu

 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 -R
# chcon -t httpd_sys_rw_content_t /var/www/html/huuphan.com -R
For example, open Caddy’s configuration file and config for your domain.
# vi /etc/caddy/Caddyfile
Replace :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

post new :

Huu Phan | Blog Linux operating system | Huu Phan ~ Zimbra Mail Server,linux,bash script,centos,linux command | www.huuphan.com

This Blog is protected by DMCA.com