Can't figure how to add a ProxyPass in Apache to a Nextcloud instance at a local IP

I have a Raspberry Pi serving a couple of static websites through Apache and doing some other stuff.

Now I’ve been gifted another Raspberry, so I installed NextCloudPi on it, and I would like to redirect a new subdomain (something like cloud.domain.com) from the first Raspberry to the new. I tried adding and enabling the following cloud.conf file in my main pi Apache’s sites-available directory but that breaks some of my other domains and does not redirect to the Nextcloud instance. What is the correct way of redirecting that subdomain?

<VirtualHost *:443>
    ServerName cloud.domain.com
    ServerAlias cloud
    ProxyPass / https://192.168.1.200:443
    ProxyPassReverse / https://192.168.1.200:443
    ProxyPreserveHost On
    ProxyPass /.well-known/acme/ !
</VirtualHost>

Should I also redirect port 80? Also, I would like to use ssl with lets-encrypt for Nextcloud, as I am doing with the main domain. Should I just run certbot on the nextcloud pi instance as I did on the main pi, or is it more complicated than that?

Have you actually enabled the modules of your Apache for operating such a proxy?

You can check the currently enabled modules with the following command:

apachectl -M

Does the listing include a module proxy and a proxy_http?

Yes, it shows both:

  • proxy_module (shared)
  • proxy_http_module (shared)

Are we talking about the main Apache server, right? Where the proxy cloud config lives.

a2enmod proxy
a2enmod proxy_http
a2enmod proxy_ajp
a2enmod rewrite
a2enmod deflate
a2enmod headers
a2enmod proxy_balancer
a2enmod proxy_connect
a2enmod proxy_html


service apache2 restart


ProxyPass / http://192.168.1.200:443/
ProxyPassReverse / http://192.168.1.200:443/

I get the same result: the cloud subdomain is not being relayed, and two of my domains break. How can I debug this?

What’s happening with your sites on the first RPI?

One of them (the one sharing domain with ncp) is OK, the other two just won’t load as soon as I run a2ensite. They seem to load infinitely but they never end loading. The screen is blank.