1. Output of
2. How I run Caddy:
as a service on Ubuntu
a. System environment:
ubuntu 20.4 CLI
c. Service/unit/compose file:
d. My complete Caddy config:
3. The problem I’m having:
4. Error messages and/or full log output:
no errors as I have not tried this yet
5. What I already tried:
I currently use caddy (with success) to reverse proxy a media server and some -arr apps. I’d like to host several websites on a single VPS, wondering if this could handle the traffic redirection.
6. Links to relevant resources:
I’m not sure I understand the question. Please be more specific.
Are these static sites? Are you looking for the
file_server directive instead?
Yes these are static sites. I have
directory 1 and inside that are all the .css and html files for a website. I have
directory 2 and inside that are all the .css and .html files for another static webpage. I want caddy to receive incoming requests like
my.domain1.com and send that to
directory1 and then
my.domain2.com gets sent to
directory2 and so on.
Thus I can host multiple websites on one VPS.
My current caddy file looks like this:
# Set this path to your site's directory.
But when I run caddy, it listens on port 2019 which I think is why I cannot reach the web site.
Alright there’s a bunch of things to cover here.
That’s invalid syntax – you need to use a
* matcher with
root because otherwise, the root will be parsed as a path matcher. See the docs, which explain:
Also, I strongly recommend moving your sites to
/var/www/html. Having your files in
/home can cause permission issues, since Caddy (running as a systemd service) doesn’t run as one of the login users, it uses the
Also, you need to enable the
file_server directive for Caddy to actually serve static files.
Caddy binds to port 2019 for its admin API, which is what allows you to gracefully reload Caddy’s config, and other things.
What’s in your logs? See this page in the docs, it explains how to see Caddy’s logs:
This topic was automatically closed after 30 days. New replies are no longer allowed.