Caddy reverse proxy configuration for multiple internal webservers

1. Caddy version (caddy version):

v2.2.0

2. How I run Caddy:

a. System environment:

Ubuntu 20.04 LTS, systemd

b. Command:

printf "[Unit]\nAfter=network.target\n\n[Service]\nLimitNOFILE=1048576\nExecStart=/usr/local/bin/caddy reverse-proxy --from easy.projectfive.co.ck --to 127.0.0.1:8080\nRestart=always\nStartLimitInterval=600\n\n[Install]\nWantedBy=multi-user.target" | sudo tee /etc/systemd/system/caddy.service

systemctl start caddy

c. Service/unit/compose file:

[Unit]
After=network.target

[Service]
LimitNOFILE=1048576
ExecStart=/usr/local/bin/caddy reverse-proxy --from easy.projectfive.co.ck --to 127.0.0.1:8080
Restart=always
StartLimitInterval=600

[Install]
WantedBy=multi-user.target

d. My complete Caddyfile or JSON config:

NA

3. The problem I’m having:

I have another webserver running on port 8081, I do not know how to change the systemd configuration to include for example:
add another --from easy1.projectfive.co.ck --to 127.0.0.1:8081 to the file?

4. Error messages and/or full log output:

I do not know where to start.

5. What I already tried:

trial and error with no luck.

6. Links to relevant resources:

At this point, you will have to change your setup from running Caddy with flags to using configuration file, such as Caddyfile or JSON. The Caddyfile is a good starting point and simpler to handle. You should be able to pick it up easily and configure your server to suit your needs.

1 Like

all running now…thank you

1 Like

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