Help - NextCloud Domain Redirects to Apache2 Debian Default Page


I’m trying to use Caddy to reverse proxy to my NextCloud server. However when I use Caddy I get the Apache2 Debian Default Page. I can get to nextcloud just fine when I type and it takes me to

Here is my CaddyFile entry for NextCloud {
proxy / {

I’m not sure if more information is needed for the CaddyFile.

Does typing have a different result?

What happens when you curl -H "" from your Caddy host?

Thanks for the reply!

I tried typing and I get:

Not Found

The requested URL /index.php/login was not found on this server.

Apache/2.4.25 (Debian) Server at Port 80

and when I do curl -H “”, I get the Apache2 Debian Default Page

This part effectively means that Caddy isn’t listening on port 80 on host, so you will need to log on to that host, stop Apache, and start Caddy.

Edit: Not relevant, shouldn’t comment while tired :frowning_face:

Ok I stopped Apache on and restarted Caddy. Now I get a 502 Bad Gateway

Oh, man, I shouldn’t be commenting when I’m tired… Please disregard the majority of the last comment, sorry.

So, should be the host your Nextcloud is running on… How have you configured your Nextcloud server, exactly?

I followed this guide How to Install NextCloud on Debian 9 Stretch with LAMP - LinuxBabe

and in the Apache Virtual Host file next to ServerName I put the ip address of the server.

EDIT: Here is my virtual Host File

    <VirtualHost *:80>
 DocumentRoot "/var/www/nextcloud"
 ErrorLog ${APACHE_LOG_DIR}/error.log
 CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /var/www/nextcloud/>
 Options +FollowSymlinks
 AllowOverride All
 <IfModule mod_dav.c>
 Dav off
 SetEnv HOME /var/www/nextcloud
 SetEnv HTTP_HOME /var/www/nextcloud
 Satisfy Any

Alright, go back to and start up Apache again.

In short, your problem is that Apache configured to only serve Nextcloud to people requesting

When Caddy is proxying from with the transparent preset enabled, though, it’s requesting from Apache, not

You can either:

1. Tell Apache to listen for

Edit /etc/apache2/sites-available/nextcloud.conf, add a ServerAlias:


2. Tell Caddy to request

Either add header_upstream Host to your Proxy directive, OR remove transparent. This is a bit of a hack and comes with some downsides.

Sorry, had to go to sleep.

So adding the ServerAlias did the trick! but when I add the header_upstream Host or remove transparent Caddy stops working {
proxy / {
header_upstream Host

Can’t seem to get it working without the Transparent directive

How does Caddy stop working, exactly?

You didn’t need to do both; only one of those options are needed.


So i’ve tested both options. Head_upstream Host option causes Caddy not to issue a cert and causes a redirect to (which leads to nothing) when typing the domain. Transparent has no such issues and a cert gets issued no problem and Nextcloud is accessible.

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