顯示具有 Caddy 標籤的文章。 顯示所有文章
顯示具有 Caddy 標籤的文章。 顯示所有文章

2022/12/26

Install Caddy on Ubuntu LTS 22.04

Caddy一套用Go撰寫的Web Server,算比較新的的Web Server
它本身是二進制檔案,沒有依賴,部署上是輕鬆的

Caddy支援Windows / Linux / macOS


Caddy優點 
  • HTTP/2
  • 支持HTTP/3
  • Automatic HTTPS
  • Multi-core
  • Websockets
  • Markdown
  • Reverse proxy
  • Load balancing
  • Static WEB
  • IPv6
  • Custom Log
  • Micro Service
Caddy缺點
  • 性能相較於Nginx / Apache還是略差
  • 功能較少
  • 社群不夠龐大
安裝命令如下
sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list
sudo apt update
sudo apt install -y caddy





下方就是預設的配置,非常清楚
80 port 的跟目錄是哪個資料夾
:80 {
        # Set this path to your site's directory.
        root * /usr/share/caddy

        # Enable the static file server.
        file_server

        # Another common task is to set up a reverse proxy:
        # reverse_proxy localhost:8080

        # Or serve a PHP site through php-fpm:
        # php_fastcgi localhost:9000
}

不過Caddy對我來說,比較好用應該是Reverse proxy