Skip to content

Instantly share code, notes, and snippets.

@Helmi
Last active October 18, 2020 18:48
Show Gist options
  • Save Helmi/e3ed46c6949bcd4f89e785c8d376277c to your computer and use it in GitHub Desktop.
Save Helmi/e3ed46c6949bcd4f89e785c8d376277c to your computer and use it in GitHub Desktop.
# meant to go with Ubuntu 18.04.
$ echo "deb [trusted=yes] https://apt.fury.io/caddy/ /" \
| sudo tee -a /etc/apt/sources.list.d/caddy-fury.list
$ sudo apt update
$ sudo apt install caddy
# start/restart commands
$ sudo systemctl daemon-reload
$ sudo systemctl enable caddy
$ sudo systemctl start caddy
# Caddyfile wherever you want it
$ cd /opt
$ nano Caddyfile
# This is your caddyfile:
{
email yourmail@forletsencrypt.org
}
yoursub.dom.ain {
reverse_proxy /long* http://localhost:7010
reverse_proxy /short* http://localhost:7020
}
# ammend ports and folder names as need, remember to add the folder to PT settings as folder prefix.
# save the file and reload caddy from the folder where the file is
$ caddy reload
# First reload will take a bit to fetch the SSL cert, watch the output for errors.
# Hint: Caddy doesn't have a fixed config file location. It writes the config into caddy while reloading so you need to reload from folder where your config file is.
# more on caddy: https://caddyserver.com/docs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment