Caddy로 Reverse Proxy HTTPS 서빙하기 (feat. Let’s encrypt)

Posted on Mon, Feb 28, 2022 컴퓨터 💻 Ubuntu

상황

Caddy로 해결

Caddy 설치

sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https 
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/cfg/gpg/gpg.155B6D79CA56EA34.key' | sudo apt-key add - 
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/cfg/setup/config.deb.txt?distro=debian&version=any-version' | sudo tee -a /etc/apt/sources.list.d/caddy-stable.list 
sudo apt update && sudo apt install -y caddy

Caddy 파일 수정

# /etc/caddy/Caddyfile, 기존 내용이 있으면 전체 삭제하면 됨.
# 아래 `mydomain.com` 부분을 수정
mydomain.com

reverse_proxy 127.0.0.1:8080

Caddy 재시작

sudo systemctl reload caddy

위와 같이 심플한 세 단계만 지나면 곧바로 해당 도메인에 Let’s Encrypt로 발급된 상태로 Reverse Proxy가 동작한다.

Reference

Usage - code-server v4.0.2 docs

This article will walk you through exposing code-server securely once you've completed the installation process. Never expose code-server directly to the internet without some form of authentication and encryption, otherwise someone can take over your machine via the terminal. By default, code-server uses password authentication.