# Issues with apache reverse proxy using the docker AIO image

**URL:** <https://help.nextcloud.com/t/issues-with-apache-reverse-proxy-using-the-docker-aio-image/166183>\
**Category:** 📦 Appliances (Docker, Snappy, VM, NCP, AIO)\
**Tags:** reverseproxy, docker, apache\
**Created:** [July 14, 2023, 9:31am UTC](https://help.nextcloud.com/t/issues-with-apache-reverse-proxy-using-the-docker-aio-image/166183 "2023-07-14T09:31:57Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![hexte](https://help.nextcloud.com/letter_avatar/hexte/32/6_22734026db12803ebb3e059622ac3534.png) [@hexte](https://help.nextcloud.com/u/hexte)\
**Post date:** [July 14, 2023, 9:31am UTC](https://help.nextcloud.com/t/issues-with-apache-reverse-proxy-using-the-docker-aio-image/166183/1 "2023-07-14T09:31:58Z")

</div>

Nextcloud version _(eg, 20.0.5)_: latest  
Operating system and version _(eg, Ubuntu 20.04)_: Ubuntu 22.04  
Apache or nginx version _(eg, Apache 2.4.25)_: 2.4.52  
PHP version _(eg, 7.4)_: 8.1.2

I have the docker AIO image deployed with the following compose file:

```auto
services:
  nextcloud:
    image: nextcloud/all-in-one:latest
    restart: always
    container_name: nextcloud-aio-mastercontainer
    volumes:
      - nextcloud_aio_mastercontainer:/mnt/docker-aio-config
      - /var/run/docker.sock:/var/run/docker.sock:ro
    ports:
      - 8081:8080
    environment: 
      - APACHE_PORT=11000 
      - APACHE_IP_BINDING=127.0.0.1
      - NEXTCLOUD_DATADIR=/mnt/hdd/data
      - NEXTCLOUD_ENABLE_DRI_DEVICE=true
volumes:
  nextcloud_aio_mastercontainer:
    name: nextcloud_aio_mastercontaine

```

And virtual host configuration:

```auto
<VirtualHost *:80>
    ServerName cloud.website.tld

    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
    RewriteCond %{SERVER_NAME} =cloud.website.tld
    RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

<VirtualHost *:443>
    ServerName cloud.website.tld

    RewriteEngine On
    ProxyPreserveHost On
    AllowEncodedSlashes NoDecode
    
    ProxyPass / http://localhost:11000/ nocanon
    ProxyPassReverse / http://localhost:11000/
    
    RewriteCond %{HTTP:Upgrade} websocket [NC]
    RewriteCond %{HTTP:Connection} upgrade [NC]
    RewriteCond %{THE_REQUEST} "^[a-zA-Z]+ /(.*) HTTP/\d+(\.\d+)?$"
    RewriteRule .? "ws://localhost:11000/%1" [P,L]

    Protocols h2 h2c http/1.1
    
    H2WindowSize 5242880

    SSLEngine on
    Include /etc/letsencrypt/options-ssl-apache.conf
    SSLCertificateFile /etc/letsencrypt/live/cloud.website.tld/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/cloud.website.tld/privkey.pem

    # Disable HTTP TRACE method.
    TraceEnable off
    <Files ".ht*">
        Require all denied
    </Files>

    # Support big file uploads
    LimitRequestBody 0
</VirtualHost>

```

Which are both basically copies form the official AIO Github page.

Nextcloud is accessible if I connect to the server through it’s local ip and port 8081, but when trying to access it through the domain all I get is the default apache “it works” landing page. I’ve been toying with both of these files for hours trying to change different things but nothing has worked yet.

---

<div class="post-metadata">

**Author:** ![Kerasit](https://help.nextcloud.com/user_avatar/help.nextcloud.com/kerasit/32/78080_2.png) [@Kerasit](https://help.nextcloud.com/u/Kerasit)\
**Post date:** [July 14, 2023, 9:38am UTC](https://help.nextcloud.com/t/issues-with-apache-reverse-proxy-using-the-docker-aio-image/166183/2 "2023-07-14T09:38:58Z")

</div>

This requires more info.

Have you setup your own Apache Reverse Proxy outside of the container?

---

<div class="post-metadata">

**Author:** ![hexte](https://help.nextcloud.com/letter_avatar/hexte/32/6_22734026db12803ebb3e059622ac3534.png) [@hexte](https://help.nextcloud.com/u/hexte)\
**Post date:** [July 14, 2023, 9:41am UTC](https://help.nextcloud.com/t/issues-with-apache-reverse-proxy-using-the-docker-aio-image/166183/3 "2023-07-14T09:41:24Z")

</div>

Yeah my bad, Apache is not running in a docker container.

---

<div class="post-metadata">

**Author:** ![Kerasit](https://help.nextcloud.com/user_avatar/help.nextcloud.com/kerasit/32/78080_2.png) [@Kerasit](https://help.nextcloud.com/u/Kerasit)\
**Post date:** [July 14, 2023, 9:42am UTC](https://help.nextcloud.com/t/issues-with-apache-reverse-proxy-using-the-docker-aio-image/166183/4 "2023-07-14T09:42:01Z")

</div>

Okay.

Client browser → Apache reverse Proxy → Container ?

---

<div class="post-metadata">

**Author:** ![hexte](https://help.nextcloud.com/letter_avatar/hexte/32/6_22734026db12803ebb3e059622ac3534.png) [@hexte](https://help.nextcloud.com/u/hexte)\
**Post date:** [July 14, 2023, 9:45am UTC](https://help.nextcloud.com/t/issues-with-apache-reverse-proxy-using-the-docker-aio-image/166183/5 "2023-07-14T09:45:40Z")

</div>

Yes. And if it’s any help I’m currently using Apache as a reverse proxy for other things so the problem I would assume is with the configuration files listed above or maybe some configuration I missed.

---

<div class="post-metadata">

**Author:** ![Kerasit](https://help.nextcloud.com/user_avatar/help.nextcloud.com/kerasit/32/78080_2.png) [@Kerasit](https://help.nextcloud.com/u/Kerasit)\
**Post date:** [July 14, 2023, 9:50am UTC](https://help.nextcloud.com/t/issues-with-apache-reverse-proxy-using-the-docker-aio-image/166183/6 "2023-07-14T09:50:27Z")

</div>

Container is setup to listen to (bind) on ports 8080 and 8081 on the Docker engine host.

The reverse proxy needs to proxy to the host machine (if on same machine as the container, you can use localhost) on the correct port.

When hitting the container, then apache inside that container, needs to listen on that interface.

Container binds on port 8081 on host machine:

client browser (default HTTPS port 443) → Apache Reverse Proxy (listening to 443) → proxy HTTP 11000 on host machine. Is the container recieving 11000 (is it bound to 11000)? Localhost is the host itself, so Apache on the host machine - not the container - recieves the proxy request, hence the answer comes from the reverse proxy itself.

---

<div class="post-metadata">

**Author:** ![szaimen](https://help.nextcloud.com/user_avatar/help.nextcloud.com/szaimen/32/63019_2.png) [@szaimen](https://help.nextcloud.com/u/szaimen)\
**Post date:** [July 14, 2023, 9:51am UTC](https://help.nextcloud.com/t/issues-with-apache-reverse-proxy-using-the-docker-aio-image/166183/7 "2023-07-14T09:51:20Z")

</div>

Hi @hexte can you follow [https://github.com/nextcloud/all-in-one/blob/main/reverse-proxy.md#6-how-to-debug-things](https://github.com/nextcloud/all-in-one/blob/main/reverse-proxy.md#6-how-to-debug-things)?

---

<div class="post-metadata">

**Author:** ![hexte](https://help.nextcloud.com/letter_avatar/hexte/32/6_22734026db12803ebb3e059622ac3534.png) [@hexte](https://help.nextcloud.com/u/hexte)\
**Post date:** [July 14, 2023, 10:11am UTC](https://help.nextcloud.com/t/issues-with-apache-reverse-proxy-using-the-docker-aio-image/166183/8 "2023-07-14T10:11:43Z")

</div>

The Nextcloud container itself is bound to port 8081 externally and it maps to 8080 inside the container but from how it’s documented in the example compose file (atleast how i understood it) is that the port declared with the environment variable “APACHE\_PORT” should be the one the proxy points to, in the examples that is 11000 and i just stuck with it.

I did also try setting up the reverse proxy to point to localhost:8081 in which case two things would happen, either I would get error 500 or it saying that I’m trying to access an HTTPS only service with an HTTP request.

---

<div class="post-metadata">

**Author:** ![hexte](https://help.nextcloud.com/letter_avatar/hexte/32/6_22734026db12803ebb3e059622ac3534.png) [@hexte](https://help.nextcloud.com/u/hexte)\
**Post date:** [July 14, 2023, 10:12am UTC](https://help.nextcloud.com/t/issues-with-apache-reverse-proxy-using-the-docker-aio-image/166183/9 "2023-07-14T10:12:16Z")

</div>

I did go over it before, and now again, sadly it did not help.

---

<div class="post-metadata">

**Author:** ![szaimen](https://help.nextcloud.com/user_avatar/help.nextcloud.com/szaimen/32/63019_2.png) [@szaimen](https://help.nextcloud.com/u/szaimen)\
**Post date:** [July 14, 2023, 10:13am UTC](https://help.nextcloud.com/t/issues-with-apache-reverse-proxy-using-the-docker-aio-image/166183/10 "2023-07-14T10:13:40Z")

</div>

Did you already enter your domain in the AIO interface?

---

<div class="post-metadata">

**Author:** ![hexte](https://help.nextcloud.com/letter_avatar/hexte/32/6_22734026db12803ebb3e059622ac3534.png) [@hexte](https://help.nextcloud.com/u/hexte)\
**Post date:** [July 14, 2023, 10:16am UTC](https://help.nextcloud.com/t/issues-with-apache-reverse-proxy-using-the-docker-aio-image/166183/11 "2023-07-14T10:16:33Z")

</div>

The only thing I did is save the password nothing else. Though going through the documentation again right now I see where I messed up in relation to @Kerasit 's explanation above.

---

<div class="post-metadata">

**Author:** ![szaimen](https://help.nextcloud.com/user_avatar/help.nextcloud.com/szaimen/32/63019_2.png) [@szaimen](https://help.nextcloud.com/u/szaimen)\
**Post date:** [July 14, 2023, 10:20am UTC](https://help.nextcloud.com/t/issues-with-apache-reverse-proxy-using-the-docker-aio-image/166183/12 "2023-07-14T10:20:07Z")

</div>

> [@hexte](#):
>
> The only thing I did is save the password nothing else.

So what do you see in the AIO interface currently? Can you maybe post a screenshot?

---

<div class="post-metadata">

**Author:** ![hexte](https://help.nextcloud.com/letter_avatar/hexte/32/6_22734026db12803ebb3e059622ac3534.png) [@hexte](https://help.nextcloud.com/u/hexte)\
**Post date:** [July 14, 2023, 10:21am UTC](https://help.nextcloud.com/t/issues-with-apache-reverse-proxy-using-the-docker-aio-image/166183/13 "2023-07-14T10:21:27Z")

</div>

The page for creating a new AIO/restoring an existing AIO instance.

---

<div class="post-metadata">

**Author:** ![szaimen](https://help.nextcloud.com/user_avatar/help.nextcloud.com/szaimen/32/63019_2.png) [@szaimen](https://help.nextcloud.com/u/szaimen)\
**Post date:** [July 14, 2023, 10:22am UTC](https://help.nextcloud.com/t/issues-with-apache-reverse-proxy-using-the-docker-aio-image/166183/14 "2023-07-14T10:22:41Z")

</div>

All right. Then you missed step 4: [https://github.com/nextcloud/all-in-one/blob/main/reverse-proxy.md#4-open-the-aio-interface](https://github.com/nextcloud/all-in-one/blob/main/reverse-proxy.md#4-open-the-aio-interface)

---

<div class="post-metadata">

**Author:** ![hexte](https://help.nextcloud.com/letter_avatar/hexte/32/6_22734026db12803ebb3e059622ac3534.png) [@hexte](https://help.nextcloud.com/u/hexte)\
**Post date:** [July 14, 2023, 10:24am UTC](https://help.nextcloud.com/t/issues-with-apache-reverse-proxy-using-the-docker-aio-image/166183/15 "2023-07-14T10:24:35Z")

</div>

If i try that it gives me an error “Domain does not point to this server or the reverse proxy is not configured correctly.” Thats why I did not do it yet.

---

<div class="post-metadata">

**Author:** ![szaimen](https://help.nextcloud.com/user_avatar/help.nextcloud.com/szaimen/32/63019_2.png) [@szaimen](https://help.nextcloud.com/u/szaimen)\
**Post date:** [July 14, 2023, 10:25am UTC](https://help.nextcloud.com/t/issues-with-apache-reverse-proxy-using-the-docker-aio-image/166183/16 "2023-07-14T10:25:33Z")

</div>

Then see [GitHub - nextcloud/all-in-one: Nextcloud AIO stands for Nextcloud All-in-One and provides easy deployment and maintenance with most features included in this one Nextcloud instance.](https://github.com/nextcloud/all-in-one#how-to-skip-the-domain-validation)

---

<div class="post-metadata">

**Author:** ![hexte](https://help.nextcloud.com/letter_avatar/hexte/32/6_22734026db12803ebb3e059622ac3534.png) [@hexte](https://help.nextcloud.com/u/hexte)\
**Post date:** [July 14, 2023, 10:46am UTC](https://help.nextcloud.com/t/issues-with-apache-reverse-proxy-using-the-docker-aio-image/166183/17 "2023-07-14T10:46:56Z")

</div>

Ok I did this now, however the issue remains. Now that it’s set up i would assume it would be accessible on port 80/443 if trying to connect locally?

---

<div class="post-metadata">

**Author:** ![szaimen](https://help.nextcloud.com/user_avatar/help.nextcloud.com/szaimen/32/63019_2.png) [@szaimen](https://help.nextcloud.com/u/szaimen)\
**Post date:** [July 14, 2023, 10:54am UTC](https://help.nextcloud.com/t/issues-with-apache-reverse-proxy-using-the-docker-aio-image/166183/18 "2023-07-14T10:54:03Z")

</div>

See [GitHub - nextcloud/all-in-one: Nextcloud AIO stands for Nextcloud All-in-One and provides easy deployment and maintenance with most features included in this one Nextcloud instance.](https://github.com/nextcloud/all-in-one#how-can-i-access-nextcloud-locally)

---

<div class="post-metadata">

**Author:** ![hexte](https://help.nextcloud.com/letter_avatar/hexte/32/6_22734026db12803ebb3e059622ac3534.png) [@hexte](https://help.nextcloud.com/u/hexte)\
**Post date:** [July 14, 2023, 10:59am UTC](https://help.nextcloud.com/t/issues-with-apache-reverse-proxy-using-the-docker-aio-image/166183/19 "2023-07-14T10:59:26Z")

</div>

This doesn’t really help since I still only get the default apache page when trying to access it.

---

<div class="post-metadata">

**Author:** ![szaimen](https://help.nextcloud.com/user_avatar/help.nextcloud.com/szaimen/32/63019_2.png) [@szaimen](https://help.nextcloud.com/u/szaimen)\
**Post date:** [July 14, 2023, 11:07am UTC](https://help.nextcloud.com/t/issues-with-apache-reverse-proxy-using-the-docker-aio-image/166183/20 "2023-07-14T11:07:48Z")

</div>

Whatt happens if you open cloud.website.tld?

[Next page](https://help.nextcloud.com/t/issues-with-apache-reverse-proxy-using-the-docker-aio-image/166183.md?page=2)
