Running Caddy on Android

Matt Holt edited this page Jun 7, 2016 · 3 revisions

So far, there are two confirmed ways to run Caddy on Android: Termux and adb. (If you find another way, please add your instructions!) If you set up your router to forward ports, you should be able to serve live sites with Caddy straight from your phone or tablet. Pretty cool!

Using Termux (root not required)

Method 1:

This is the easiest way. Ensure curl is installed (apt install curl), then:

curl | bash

You can use -s to get Caddy with plugins:

curl | bash -s ipfilter,jwt

Allow the download a minute to start after submitting the command.

Then run caddy to start the server!

Method 2: Build from source

This method downloads and builds Caddy from source directly on your device.

Put these commands into a bash script and run it. You can, of course, customize this as desired. For example, you may replace nano with any other editor in the list of available packages.

apt install git gcc golang nano
export GOPATH=~/dev
export CGO_ENABLED=0
export PATH=$PATH:$GOPATH/bin
go get

Note that the build step may take two or three minutes, depending on your device. On the Nexus 9 it takes about one minute.

With your GOPATH set and with $GOPATH/bin in your PATH, you're ready to run Caddy:

$ caddy

If you want to build Caddy with cgo, use -buildmode=archive.

Side-loading using adb (root not required)

Caddy is available for Linux ARM, which means it can run on most newer Android devices.


  • Android with ARM architecture
  • adb (part of the Android SDK; if you have Android Studio, you already have adb)
  • A copy of Caddy for ARM Linux

Basic Instructions

Assuming the ARM binary is called caddy, run:

$ adb push caddy /data/local/tmp
$ adb shell "cd /data/local/tmp; chmod 755 caddy; ./caddy"

You may also want to push a Caddyfile to customize how Caddy runs.