How do I get NextCloud running on HTTPS / SSL instead of HTTP?
I'm trying to get NextCloud running alongside a Collabora instance, but I keep running into problems relating to the SSL certificates.
Primarily, I can't access my NextCloud installation when I use HTTPS instead of HTTP.
The only way I can access NextCloud in my broswer is with one of these two URLS:
or
NOW… I set up my certificates properly (or at least functionally) in Apache, so I can successfully access:
and
BUT, NextCloud only runs when I add the "8080" port, and the SSL never works when I use the "8080" port.
SO… is there a way to make the SSL work for an appended port?
Or, is there a way to access NextCloud without using the port in the URL?
Or, am I missing something entirely?
Side-question: Is it okay to use the same certificate for both NextCloud and Collabora? Or do they need separate certificates?
I tried it with LetsEncrypt and with a self-signed certificate. So far, both failed.
2 Replies
Hello,
You will likely need to configure your web service virtual hosts to listen on port 8080. You can do this by adding the following to your virtual host configuration in Apache, for example:
<VirtualHost *:8080>
ServerName the.server.name
ServerAlias *
DocumentRoot /var/www/ssl
SSLEngine On
SSLCertificateFile /the/certificate/file
SSLCertificateKeyFile /the/key/file
</VirtualHost>
You will also want to make sure you have the following in either your apache.conf
file or your ports.conf
file:
Listen 80
<IfModule ssl_module>
Listen 443
Listen 8080
</IfModule>
You can read a bit more about how someone was able to get this running at the NextCloud support site.
I hope this helps!
@scrane Thanks very much for the response.
I did this but when I restarted my apache2 server it failed to restart:
Job for apache2.service failed because the control process exited with error code.
When I checked the log it said that 8080 is already in use (I assume because that's where NextCloud is running).
So, specifically, when I add:
Listen 8080
…to my ports.conf file, Apache2 won't start. When I remove it, Apache2 starts like normal.
Also, I did create a CONF file for the domain where I want the :8080 port to connect. I mean, I made a "domain.com.conf" file, put the port as 8080, and added the links to the certificates.
Now, in that situation, I can now go to https://domain.com and I get sent to Apache2's default filler-page. But it doesn't send me to my nextcloud installation.
I can only open my NextCloud with the "http" and "8080" included:
http://DOMAIN.COM:8080 (successfully load NextCloud)
I CANNOT open NextCloud with https:
https://DOMAIN.COM:8080 (gets an error - see below)
This tells me "Secure Connection Failed" and:
An error occurred during a connection to DOMAIN.COM:8080. SSL received a record that exceeded the maximum permissible length. Error code: SSLERRORRXRECORDTOO_LONG
yet, if I remove the "s" and make it regular http, I successfully get into NextCloud, and if I instead remove the ":8080" I successfully load the SSL-enabled default-page from Apache2.
So… what am I doing wrong?
EDIT:
I installed NextCloud before I installed Apache2, and it seems like NextCloud doesn't even use Apache2, so I don't know how I'm supposed to bind the certificate to NextCloud. Their only official suggestion is to enable SSL in the command line, which I did, but it has no effect on NextCloud.
EDIT 2:
I can also go to https://DOMAIN.COM:80 and get the default test page that I made when setting up my virtual hosts, but when I use :8080 then I get the SSL error.