Running multiple websites off of one server?

1. Caddy version (caddy version):

V2.5.1

2. How I run Caddy:

I am using caddy to run a few static websites that are only html/css. Pretty simple stuff, but a fascination of mine these days…lol

a. System environment:

Ubuntu 22.04 on Linode

b. Command:

I have it autostarting

systemctl enable caddy

c. Service/unit/compose file:

Paste full file contents here.
Make sure backticks stay on their own lines,
and the post looks nice in the preview pane.

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 ":80" below with your
# domain name.

timapple.com {
        # Set this path to your site's directory.
        root * /var/www/html/timapple.com

        # Enable the static file server.
        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
}

timapple.dev {
        # Set this path to your site's directory.
        root * /var/www/html/timapple.dev

        # Enable the static file server.
        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:
# https://caddyserver.com/docs/caddyfile

3. The problem I’m having:

So I am actually not having a problem, I am just looking for reassurance, this was like stupid easy to get to sites going on two domains and I want reassurance I did it right. I will be adding a few more on here and want to catch any future problems I may run into ahead of time. It may be all good, but it was so easy I feel I’m doing something wrong.

4. Error messages and/or full log output:

5. What I already tried:

6. Links to relevant resources:

1 Like

Yep, that’s how you do it.

3 Likes