Running Caddy API in Virtual Machine

1. Caddy version (v2.0.0 h1:pQSaIJGFluFvu8KDGDODV8u4/QRED/OPyIR+MWYYse8=):

2. How I run Caddy:

I am running Caddy in a virtual machine on Ubuntu following the documentation laid out in the download guide.

a. System environment:

Ubuntu 20.04 LTS

b. Command:

No commands.

c. Service/unit/compose file:

d. My complete Caddyfile or JSON config:

# The Caddyfile is an easy way to configure your Caddy web server.
# Unless the file starts with a global options block, the first
# uncommented line is always the address of your site.
# To use your own domain name (with automatic HTTPS), first make
# sure your domain's A/AAAA DNS records are properly pointed to
# this machine's public IP, then replace the line below with your
# domain name.

# Set this path to your site's directory.
root * /usr/share/caddy

# Enable the static 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

# Refer to the Caddy docs for more information:

3. The problem I’m having:

I am running Caddy inside of a virtual machine (I can access using and I would like to enable the API to handle traffic on that IP address so I can use it from my host machine (macOS) and not have to ssh into the virtual machine and use localhost:2019.

4. Error messages and/or full log output:

No errors.

5. What I already tried:

Read the documentation but did not see how to configure the Caddy API to listen on a different address.

6. Links to relevant resources:

You’re looking for the admin global option:

You can see where the global options fit in the Caddyfile structure here:


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.