How to Use Caddy
Caddy is simpler compared to Nginx and very convenient for server proxying, especially for obtaining HTTPS certificates.
Here are some common operations recorded.
Installation
It is recommended to use a package manager for installation, such as on Mac:
1 | brew install caddy |
On CentOS7:
1 | yum install yum-plugin-copr |
On Ubuntu:
1 | sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https curl |
For installation on other OS, see https://caddyserver.com/docs/install#install
Common Commands
1 | Start service |
Examples
Reverse Proxy for Local Service
1 | 127.0.0.1:3001 { |
Reverse Proxy for External Service
1 | example.com { |
Serve Static Assets
1 | 1991421.cn { |
At the end
That’s all I know. I recommend learning from the official doc for more information on how to use it.