Help - NextCloud Domain Redirects to Apache2 Debian Default Page

(Franklin Lee) #1


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.

(Matthew Fay) #2

Does typing have a different result?

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

(Franklin Lee) #3

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

(Matthew Fay) #4

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:

(Franklin Lee) #5

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

(Matthew Fay) #6

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?

(Franklin Lee) #7

I followed this guide

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

(Matthew Fay) #8

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.

(Franklin Lee) #9

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

(Franklin Lee) #10

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

(Matthew Fay) #11

How does Caddy stop working, exactly?

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

(Franklin Lee) #12


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.

(system) #13

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