# Help with Apache Reverse Proxy to NC Docker Instance

**URL:** <https://help.nextcloud.com/t/help-with-apache-reverse-proxy-to-nc-docker-instance/223367>\
**Category:** 📦 Appliances (Docker, Snappy, VM, NCP, AIO)\
**Tags:** docker, aio\
**Created:** [April 22, 2025, 6:16pm UTC](https://help.nextcloud.com/t/help-with-apache-reverse-proxy-to-nc-docker-instance/223367 "2025-04-22T18:16:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![GJSchaller](https://help.nextcloud.com/user_avatar/help.nextcloud.com/gjschaller/32/1008_2.png) [@GJSchaller](https://help.nextcloud.com/u/GJSchaller)\
**Post date:** [April 22, 2025, 6:16pm UTC](https://help.nextcloud.com/t/help-with-apache-reverse-proxy-to-nc-docker-instance/223367/1 "2025-04-22T18:16:28Z")

</div>

A while back, I set up a Docker image for Nextcloud on my host, and successfully set up a Reverse Proxy from a public-facing webserver to help serve up Nextcloud. Long story short, my host crashed, and I had to rebuild my webserver from scratch. The docker image survived, and is running fine, but for the life of me, I cannot get the Proxy to work again, and I can’t restore from backup for the proxy.

The docker image is up and running fine - I can browse it by IP if I disable URL rewrite. The problem is solely with the Apache2 Reverse Proxy.

The docker is using a self-signed SSL cert. I remember having to set the Proxy to tolerate this, but my internal notes are lacking, and I can’t find how I did it properly the first time any more.

I looked at the AIO Proxy guide, and tried to follow it, but I’m still getting a 500 Internal Server error when trying to proxy to the Nextcloud instance. I’ll post my Apache config below, any insight as to what I am missing would be appreciated.

```auto
SuexecUserGroup #1001 #1001
ServerName cloud.aiskon.net
DocumentRoot /home/aiskon/domains/cloud.aiskon.net/public_html
ErrorLog /var/log/virtualmin/cloud.aiskon.net_error_log
CustomLog /var/log/virtualmin/cloud.aiskon.net_access_log combined
ScriptAlias /cgi-bin/ /home/aiskon/domains/cloud.aiskon.net/cgi-bin/
DirectoryIndex index.php index.htm index.html
<Directory /home/aiskon/domains/cloud.aiskon.net/public_html>
    Options -Indexes +IncludesNOEXEC +SymLinksIfOwnerMatch 
    Require all granted
    AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
</Directory>
<Directory /home/aiskon/domains/cloud.aiskon.net/cgi-bin>
    Require all granted
    AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
</Directory>
# Reverse proxy based on https://httpd.apache.org/docs/current/mod/mod_proxy_wstunnel.html
RewriteEngine On
ProxyPreserveHost On
RequestHeader set X-Real-IP %{REMOTE_ADDR}s
AllowEncodedSlashes NoDecode

# Adjust the two lines below to match APACHE_PORT and APACHE_IP_BINDING. See https://github.com/nextcloud/all-in-one/blob/main/reverse-proxy.md#adapting-the-sample-web-server-configurations-below
ProxyPass / https://10.0.0.253:11000/ nocanon
ProxyPassReverse / https://10.0.0.253:11000/

SSLEngine on
SSLCertificateFile /home/aiskon/ssl.combined
SSLCertificateKeyFile /home/aiskon/ssl.key
SSLCACertificateFile /home/aiskon/ssl.ca
SSLProtocol all -SSLv2 -SSLv3 -TLSv1 -TLSv1.1
RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]
RewriteCond %{HTTP:CONNECTION} ^Upgrade$ [NC]
RewriteRule ^/?(.*) "wss://10.0.0.253:11000/$1" [P]
SSLProxyCheckPeerCN off
SSLProxyCheckPeerName off
SSLProxyCheckPeerExpire off
SSLHonorCipherOrder off
SSLSessionTickets off

```

---

<div class="post-metadata">

**Author:** ![vawaver](https://help.nextcloud.com/user_avatar/help.nextcloud.com/vawaver/32/71824_2.png) [@vawaver](https://help.nextcloud.com/u/vawaver)\
**Post date:** [April 22, 2025, 6:54pm UTC](https://help.nextcloud.com/t/help-with-apache-reverse-proxy-to-nc-docker-instance/223367/2 "2025-04-22T18:54:44Z")

</div>

Is your problem similar to this?

> [@Can't make reverse proxy work between public Apache server and local Nextcloud server](https://help.nextcloud.com/t/cant-make-reverse-proxy-work-between-public-apache-server-and-local-nextcloud-server/222774):
>
> The Basics Nextcloud Server version: Nextcloud AIO v10.11.10 Operating system and version: Debian 12 / Centos 7 Reverse proxy and version: Apache Installation method: Docker AIO Summary of the issue you are facing: With docker I’ve managed to install Nextcloud\_AIO, with almost no problems. This runs on a Debian host, connected to my local network (192.168.1.179). I have a public web server (Apache) running without problems on a Centos 7 host, also connected to the local network. I…

---

<div class="post-metadata">

**Author:** ![GJSchaller](https://help.nextcloud.com/user_avatar/help.nextcloud.com/gjschaller/32/1008_2.png) [@GJSchaller](https://help.nextcloud.com/u/GJSchaller)\
**Post date:** [April 22, 2025, 7:20pm UTC](https://help.nextcloud.com/t/help-with-apache-reverse-proxy-to-nc-docker-instance/223367/3 "2025-04-22T19:20:42Z")

</div>

I was able to dig up my old Apache config, and confirm it’s working. I’ll paste it here for reference:

```auto
    ServerName cloud.aiskon.net
    ServerAlias www.cloud.aiskon.net
    ServerAlias mail.cloud.aiskon.net
    ServerAlias webmail.cloud.aiskon.net
    ServerAlias admin.cloud.aiskon.net
    DocumentRoot /home/aiskon/domains/cloud.aiskon.net/public_html
    ErrorLog /var/log/virtualmin/cloud.aiskon.net_error_log
    CustomLog /var/log/virtualmin/cloud.aiskon.net_access_log combined
    DirectoryIndex index.php index.php4 index.php5 index.htm index.html
    <Directory /home/aiskon/domains/cloud.aiskon.net/public_html>
        Options -Indexes +IncludesNOEXEC +SymLinksIfOwnerMatch 
        Require all granted
        AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
    </Directory>
    <Directory /home/aiskon/domains/cloud.aiskon.net/cgi-bin>
        Require all granted
        AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
        SetHandler proxy:unix:/var/fcgiwrap/173439249341172.sock/socket|fcgi://localhost
        ProxyFCGIBackendType GENERIC
    </Directory>
    RewriteEngine on
    RewriteCond %{HTTP_HOST} =webmail.cloud.aiskon.net
    RewriteRule ^/(?!.well-known)(.*)$ https://cloud.aiskon.net:20000/ [R]
    RewriteCond %{HTTP_HOST} =admin.cloud.aiskon.net
    RewriteRule ^/(?!.well-known)(.*)$ https://cloud.aiskon.net:10000/ [R]
    ScriptAlias /cgi-bin/ /home/aiskon/domains/cloud.aiskon.net/cgi-bin/
    RemoveHandler .php
    RemoveHandler .php7.4
    RemoveHandler .php8.0
    RemoveHandler .php8.3
    <FilesMatch \.php$>
        SetHandler proxy:unix:/run/php-fpm/173439249341172.sock|fcgi://127.0.0.1
    </FilesMatch>
    <IfModule mod_headers.c>
        Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains"
    </IfModule>
    <IfModule mod_rewrite.c>
        RewriteEngine on
        RewriteRule ^\.well-known/carddav https://cloud.aiskon.net/remote.php/dav [R=301,L]
        RewriteRule ^\.well-known/caldav https://cloud.aiskon.net/remote.php/dav [R=301,L]
        RewriteRule ^\.well-known/webfinger https://cloud.aiskon.net/index.php/.well-known/webfinger [R=301,L]
        RewriteRule ^\.well-known/nodeinfo https://cloud.aiskon.net/index.php/.well-known/nodeinfo [R=301,L]
    </IfModule>
    SSLEngine on
    SSLCertificateFile /home/aiskon/ssl.combined
    SSLCertificateKeyFile /home/aiskon/ssl.key
    SSLCACertificateFile /home/aiskon/ssl.ca
    SSLProtocol all -SSLv2 -SSLv3 -TLSv1 -TLSv1.1
    ProxyPass /.well-known/webfinger !
    ProxyPass / https://10.0.0.253:11000/
    ProxyPassReverse /.well-known/webfinger !
    ProxyPassReverse / https://10.0.0.253:11000/
    RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]
    RewriteCond %{HTTP:CONNECTION} ^Upgrade$ [NC]
    RewriteRule ^/?(.*) "wss://10.0.0.253:11000/$1" [P]
    SSLProxyEngine on
    SSLProxyVerify none 
    SSLProxyCheckPeerCN off
    SSLProxyCheckPeerName off
    SSLProxyCheckPeerExpire off

```

---

<div class="post-metadata">

**Author:** ![system](https://help.nextcloud.com/user_avatar/help.nextcloud.com/system/32/29333_2.png) [@system](https://help.nextcloud.com/u/system)\
**Post date:** [April 30, 2025, 7:21pm UTC](https://help.nextcloud.com/t/help-with-apache-reverse-proxy-to-nc-docker-instance/223367/4 "2025-04-30T19:21:08Z")

</div>

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