Nextcloud is an open source cloud data server. On OS's with snapd
you can install the whole thing as a snap:
sudo snap install nextcloud
That seems magical, but I am stuck there. My server was already hosting various domains using Apache, and I do not even know where to look for the landing page of nextcloud. All the instructions / manuals I can find do not explain where the site is, or how the snap will interact with existing Apache. I now suspect I cannot use a snap if I already have Apache running? But this was not clear in what I read.
I have a separate IP domain for the nextcloud server, so I just need the snap to take care of requests for one domain-name.
Can I use snap to install nextcloud on a server already running Apache?
Update:
I have tried the following:
sudo snap install nextcloud
sudo snap set nextcloud ports.http=81
sudo snap restart nextcloud.apache
At that point I can see the nextcloud page exists with
links http://localhost:81
However, I cannot access it from another computer to continue the setup. How do I proceed? (The hope at this point is that I can have the server's main/existing Apache2 server map port 81 and 443 to a virtual host of my chosen domain name).
Update 2:
One problem, above, was that the port 81 was blocked to the outside world.
Let's say that I have unused ports 9992
and 9993
visible to the Internet from my existing Ubuntu 18.04 LTS server with IP address 111.222.333.444:
and IP name example.net
; and that this server is hosting various sites already using Apache 2.4.29-1ubuntu4.13
; and that I have set up a new IP name clouddomain.example.org
that points to the same IP addres as example.net
.
I find that using a modern browser, even under incognito mode, and even using ctrl-shift-r to reload pages, does not reflect my latest changes as I make them (ie, is caching things). Therefore, I use links
to test URLs in the procedure below.
I run
sudo snap install nextcloud
sudo nextcloud.manual-install myadmin mypassword
sudo snap set nextcloud ports.http=9992
At this point,
links http://example.net:9992
displays the nextcloud landing page.
I then set up an Apache .conf file with contents
<VirtualHost 111.222.333.444:80>
ServerName clouddomain.example.org
ErrorLog /var/log/apache2/clouddomain.example.org_error_log
CustomLog /var/log/apache2/clouddomain.example.org_access_log combined
ProxyPass / http://localhost:9992/
ProxyPassReverse / http://localhost:9992/
</VirtualHost>
and I link it from sites-available to sites-enabled and I restart the OS's Apache server with one of:
sudo service apache2 reload
sudo service apache2 reload
Now
links http://clouddomain.example.org
gets me to the nextcloud page. Calling
sudo nextcloud.occ config:system:set overwritehost --value="clouddomain.example.org"
makes no difference at this point.
Next, I need to get the site working with SSL (https). I cannot. If I call
sudo nextcloud.enable-https lets-encrypt
and enter the appropriate information, I am told that a certificate has been issued and Apache restarted. However, this leaves nothing working. The non-SSL page is no longer available; it gives me a 503 error. The SSL page is also not available:
links https://clouddomain.example.org:9993
gives connection refused.
There are no error events created for these efforts at /var/snap/nextcloud/current/apache/logs/error_log
Not surprisingly, creating the second proxy conf for the Apache2 server on example.net does not help, but here is what I'm using:
<VirtualHost 111.222.333.444:80>
ServerName clouddomain.example.org
ErrorLog /var/log/apache2/clouddomain.example.org_error_log
CustomLog /var/log/apache2/clouddomain.example.org_access_log combined
ProxyPass / http://localhost:9992/
ProxyPassReverse / http://localhost:9992/
</VirtualHost>
I've noticed another problem, which suggests to me that one of my issues might be idiosyncratic, though I don't think this is the only issue: when I activate the SSL proxy, my other sites, not at clouddomain.example.org but hosted by the sever example.net, fail to conect by https. This is true even without nextcloud installed.