I have a need to run another webserver running on a separate VM. My primary Caddy server is primarily used for reverse proxy & has been serving me well.
I need help to configure this primary Caddy Server to proxy all requests to the 2nd Caddy server for domain2.mydomain.com
5. What I already tried:
i tried the proxy directive, but i guess thats not supported in v2
& on the server where cloud is running, this is my caddyfile
cloud.mydomain.com {
encode zstd gzip
templates
file_server browse
root * /usr/share/caddy
# 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
}
When I restart my main caddy, i’m unable to reach the cloud server
I have specified the IP of the Main Server (192.168.11.6) in Unbound as the Override (Is this the Upstream Server>?) So all traffic that hits my firewall for cloud.mydomain.com hits this server. I guess this is where the LE cert is generated.
The 2nd server (Downstream?) another Caddy instance is running
If you please dont mind can you please let me know what my Caddyfile should look like?
Your backend will not fetch a certificate from Let’s Encrypt, because it doesn’t need one, since your first one will be doing it. Specifying http:// will tell Caddy not to manage a TLS certificate for that domain, and will make sure it’s serving the site over port 80 instead of 443 (your first one will try to proxy on port 80 because you specified http:// on the upstream address).