Access Nextcloud in HTTPS behind an Apache reverse proxy

I use a Apache reverse proxy to access my Nextcloud server. In HTTP, it works.
In HTTPS, it does not work and I have the following error:
“# Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.”
I have a valid Letsencrypt certificate created on the reverse proxy.
Internet-> RevProxy (HTTPS)
RevProxy-> Nextcloud (HTTP)

How do I configure Nextcloud to work?

Part of my “config.php” file
HTTPS streams use, http streams
A term, Nextcloud should be forced into https.

‘trusted_proxies’ =>
array (
0 => ‘’,
1 => ‘’,
‘overwrite.cli.url’ => ‘’,
‘overwritehost’ => ‘’,
‘overwriteprotocol’ => ‘http’,
‘overwritewebroot’ => ‘’,
‘overwritecondaddr’ => ‘^$’,

You have 302 redict when using It redirects to http.

If you use then there’s no redirection and you’ll see NC mainpage with https.

Thank you for your reply.
I’m not very comfortable with redirects.
At what level should it be corrected
(On the reverse proxy, on the server Nextcloud (htaccess and/or CONFIG. php) ?

I don’t use Apache so I can’t say much about it.
If you post your configs, maybe someone can help.
This guide may be worth of reading if you haven’t.

Hi MeiRos,

Thank you for your help.
I managed to switch Nextcloud to HTTPS by redirecting all the requests that arrived on port 80 in my reverse proxy.

It works very well now.


Redirect permanent /

ErrorLog /var/log/httpd/scloud-pw80.log
LogLevel debug

Thank you again.

1 Like