Apache Reverse Proxy for Nextcloud

Been searching around for the proper config to have nextcloud setup through a reverse proxy. The setup works fine by going directly to the internal ip address, which is great (also works by going directly to the outside ip with port fowarding.) I am working to set up NC through my domain (nextcloud.domain.com). My current apache reverse proxy setup is:

<IfModule mod_ssl.c>
<VirtualHost *:80>
ServerName nextcloud.mydomain.com
ServerAdmin myemail@server.com

RewriteEngine on
RewriteCond %{SERVER_NAME} =nextcloud.mydomain.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]

<VirtualHost *:443>
ServerName nextcloud.mydomain.com
ServerAdmin myemail@server.com

<proxy *>
AddDefaultCharset off
Order Allow,Deny
Allow from all

ProxyRequests     Off
ProxyPreserveHost On

<location />
RequestHeader unset Accept-Encoding
Order allow,deny
Allow from All

SSLCertificateFile /usr/local/etc/letsencrypt/live/mydomain.com/fullchain.pem
SSLCertificateKeyFile /usr/local/etc/letsencrypt/live/mydomain.com/privkey.pem


Anything stand out or has anyone know where I should look first? With this config here is the page I see when going to the site: [link] (http://imgur.com/pcVHpqM)

1 Like

It’s fixed. Half the problem was getting lighttpd set back to only serve over http and then have my apache installation on the reverse proxy serve the cert and ssl files to make it https. Oh and the fact that I typed the IP address wrong in the config…hahah oops dumb mistake.

On the plus side if anyone is looking for a working config for apache and nextcloud through a reverse proxy…there it is :slight_smile: cheers.

1 Like