Having AIO Nextcloud, now add 2 "normal" websites?

The Basics

  • Nextcloud Server version (e.g., 29.x.x):
    • Nextcloud AIO Docker Container (30.0.0)
  • Operating system and version (e.g., Ubuntu 24.04):
    • OpensuseLeap 16
  • Web server and version (e.g, Apache 2.4.25):
    • apache2 2.4.63
  • Installation method (e.g. AlO, NCP, Bare Metal/Archive, etc.)
    • AIO
  • Are you using CloudfIare, mod_security, or similar? (Yes / No)
    • No

Summary of the issue you are facing:

So I run my AIO setup in a container, my domain points to my home router that redirects to my NextCloud server/AIO Docker image. All fine.

But now I do want to serve two other domains, plain websites, nothing fancy.

My traffic to home router resolves now from 3 domains to 1 IP (instead of initially 1). But I only want the original Nextcloud URL to resolve to Nextcloud the other domains should be picked up and point to (two different) Apache2 hosted simple sites.

Steps to replicate it (hint: details matter!):

  1. Leave AIO container intact but now only on my.cloudserverurlathome.com (not for all traffic)

  2. The two other domains myowndomainkeepout.net and notrespassingallowed.eu should be served by two different running webservers on the same machine (either in a docker container or plain apache2 instance) preferably with their own DNS based own LetsEncrypt (because wildcard) certificates

  3. I figured to setup a vhost.conf file for the apache server with three entrys. One for each (sub)domain, but one of the entries point to my AIO containerized instance.

  4. What is the most sane way?

you need a “reverse proxy” 101: reverse proxy

Thanks for the info-link. I read something about AIO and reverse proxy, not assuming it was for me (it wasn’t at that time). I read about what to change in the config, will that be persistent over updates of the MasterContainer? And I understand the AIO MasterContainer can also function as a reverse proxy in simple cases, is it possible to point to two other docker containers for both other domains? Are there somewhere documented examples?

Yes, technically Nextcloud All-in-One already uses a reverse proxy (Caddy) to proxy requests to the Apache HTTP Server serving Nextcloud itself, as well as to the other backends like Collabora Online, Notify Push, Talk HPB, etc.

However, I wouldn’t recommend messing with its configuration, as it will most likely get overwritten during updates anyway. You could also use a manual Docker Compose setup for AIO and then maybe add additional services yourself, but I wouldn’t recommend that either. It only adds complexity and somewhat defeats the purpose of AIO, which is meant to take care of these things for you.

So my recommendation would be to run the website in a completely separate Docker stack and then use a separate reverse proxy in front of both stacks. Alternatively, you could take a look at the AIO community containers. There’s an NGINX Proxy Manager container as well as a Caddy container. The latter might already be enough if you just want to serve a simple website.

I did make some progress, that is to say: currently the two other sites run with DNS wildcard certificates. And also the NC instance should run on its own domain with the instance hostname under its domain. So it is https towards the proxy. Then in the vhost file I redirect ServerName ‘cloud.my.domain’ towards ProxyPass "/" "``http://127.0.0.1:8182/``" nocanon and ProxyPassReverse "/" "``http://127.0.0.1:8182/``"which should be my local AIO Apache container and the docker run command line includes sudo docker run \
--env APACHE_IP_BINDING=0.0.0.0 \
--env APACHE_ADDITIONAL_NETWORK="" \
--env SKIP_DOMAIN_VALIDATION=false \
--publish 8182:80 \(among other less relevant directives)

But when connecting to my cloud url cloud.my.domainthen Firefox complains about invalid redirect. Is that caused by putting an TLS proxy in place forwarding https to the internal port 80 (no TLS)? Do I need something in config.php to allow NC to run without its own certificate?

I use a similar scenario.

Selfhosting a lot of docker services on different domains and subdomains on the same server.
You can find more info about AIO setup here.

Mine is a dedicated Linux PC running Apache, keep it stupid simple. No idea yet how to serve the two domains, probably with plain HTML/svg. Will go through your tutorial though as to find out where I am missing a clue.

At last, got all running. And in hindsight, what took me so long? Well to mention a few:

Host opensuse did do some odd things after enabled modules in Apache, the loaded modules were put in another file which did not get loaded. After that was fixed, all kind of directives at last started to work. Then I had to switch the way Docker ran the containers (for I used the script “not behind reverse proxy” … And of course I made some typo’s in the ports used and IP addresses… And I was not (yet) able to run the DNS-PERSIST-01 challenge with the now current certbot binary on my host. So after some three months I still have to renew my DNS-01 certificates manually. And yes, it took some time to discover that I did forget to open the appropriate ports (tcp and udp) in my firewall, all after I figured out in what zone my server would live and which command to use to manipulate the settings.

To kill all (running) docker containers and be able to restart all I did create a stopkill.sh file:

#!/bin/bash
cNCc="$( sudo docker ps -a | grep aio-mastercontainer | cut -f 1 -d ' ' )"
sudo docker stop ${cNCc}
sudo docker stop $(docker ps -a -q) 
sudo docker rm $(docker ps -a -q)

And to (re)start the instance (with a refresh of the master container) I now use start_nc.sh

#!/bin/bash
# For Linux and with a web server or reverse proxy already in place:
cNCc="$( sudo docker ps -a | grep aio-mastercontainer | cut -f 1 -d ' ' )"
sudo docker stop ${cNCc}
sudo docker rm ${cNCc}
sudo docker pull ghcr.io/nextcloud-releases/all-in-one:latest
sudo docker run \
        --env NEXTCLOUD_MOUNT="/cloudlocation/" \
        --env NEXTCLOUD_DATADIR="/cloudlocation" \
        --env APACHE_PORT=8182 \
        --env APACHE_IP_BINDING=<internalIP> \
        --env APACHE_ADDITIONAL_NETWORK="" \
        --env SKIP_DOMAIN_VALIDATION=false \
        --init \
        --sig-proxy=false \
        --name nextcloud-aio-mastercontainer \
        --restart always \
        --publish 8181:8080 \
        --security-opt label:disable \
        --volume nextcloud_aio_mastercontainer:/mnt/docker-aio-config \
        --volume /var/run/docker.sock:/var/run/docker.sock:ro \
        -d ghcr.io/nextcloud-releases/all-in-one:latest

After running this script I can go to http://{internalIP}:8181 (and allow self-signed AIO management page to load) and start (and refresh) all containers.

Note: I picked up the -d flag to detach the docker container to run in the background. It is not in the provided run script (I have no idea yet how to use compose.yaml). I also created an executable “docc” command in my ~/bin/ dir with this content:

sudo docker exec --user www-data -it nextcloud-aio-nextcloud php /var/www/html/occ ${1} ${2} ${3} ${4} ${5} ${6} ${7} ${8} ${9} ${10} ${11} ${12} 

which serves as a commandline occ replacement but then from outside the container (usable in a ssh shell / cli of the headless cloudserver)

Had to fix /etc/apache2/httpd.conf to load the a2enmod modules (from /etc/apache2/sysconfig.d/loadmodule.conf instead of /etc/apache2/loadmodule.conf) The default vhost.conf example for Apache did the job quite well, other directives to allow real IP addresses in logs etc, still have to be done (because mod_rewrite was not loaded, see loadmodule issue above, these settings kept throwing me errors. Should be good to redo that part now. And oh, mod_security2, I have to look into that one too yet. And then I did setup my primary fallback vhost and my cloudserver as wel as all other vhosts in the /etc/apache2/vhost.d/allhosts.conf file with plenty of settings to finetune still.

Then at last had to set the proper way of parameters in /var/lib/docker/volumes/nextcloud_aio_nextcloud/_data/config/config.phpespecially for the 'trusted_proxies' => array where “localhost” was not appreciated… And I found out that setting entries in the config.php using docc was, well, not always correct…

In the end, I think it is working again. Now as one of several hosted sites on the 2nd-live old work computer. All in all, yes, it was all documented (and well documented) but all those words were playing hard-to-grasp in my mind. Hence a brief description of a lot of hours searching and trying. Sorry for the WallOfText.

And one more issue: Running Nextcloud 33.0.3.2 NOT on latest patch level

Major version still supported Scanned at 2026-06-04 22:44:47