Virtualmin, Ubuntu, Snap install of NextCloud

Operating system Ubuntu Linux 20.04.2
Webmin version 1.970 Usermin version 1.820
Virtualmin version 6.14 Authentic theme version 19.70
Firewall version [ConfigServer Security & Firewall] 14.08
Kernel and CPU Linux 5.4.0-65-generic on x86_64
Processor information Intel® Xeon® CPU X5550 @ 2.67GHz, 8 cores

This is my first Ubuntu server and the first time I have ever installed using snaps.

I have my server up and running with the latest installs of webmin and virtualmin
I have letsEncrypt certificates for the main domain and subdomains
CSF is installed and running with required ports open
I decided I would try and install the snap version of NextCloud

I have it installed and used the command line to set up the admin user as well as change the ports for it. I figured I would have to access it in a similar manner as Webmin since it runs its own apache webserver.

I altered the virtual server settings to redirect to the ports I used for NextCloud and ensured that those ports were indeed being used as well as restarting the services and ensuring they were all up and running for the NextCloud snap.

I have set my apache virtural hosts to redirect the NextCloud in the same way that I have Webmin redirected (and works) and have also included the appropriate alias

These are examples of the lines from my sites-available/domain.conf file:
ServerAlias admin.myserver.com
ServerAlias nextcloud.myserver.com

RewriteCond %{HTTP_HOST} =admin.myserver.com
RewriteRule ^(?!/.well-known)(.) https://myserver.com:10000/ [R]
RewriteCond %{HTTP_HOST} =nextcloud.myserver.com
RewriteRule ^(?!/.well-known)(.
) https://myserver.com:10443/ [R]

I can’t access the NextCloud site with this setup. I appear to be having a certificate issue
Secure Connection failed
PR_END_OF_FILE_ERROR

Is there some trick I have missed to set up a self contained snap within my webmin/virtualmin setup?
Is the issue due to the certificate on the virtualhost but not on the nextcloud setup?
I can’t find any information specific to this kind of setup.
I am at the point now of just deleting the snap setup of NextCloud and doing a standard setup which I understand. If the setup of snaps is this difficult within the Virtualmin system I don’t see any benefit to using them.
I am hoping I have just done some stupid setup error or am misunderstanding the concept of snaps. Does anyone else have this working properly?

You described your situation really well but the following part isn’t making sense (unless I’m not reading you correctly, or I’m more clueless about snaps than I thought):

I’ve always thought snapd looks and acts like a container but isn’t a container in real life since its packages still use and rely on the system. In which case your Nextcloud installation should be using Apache server already installed by Virtualmin, preferrably on standard ports 80 and 443 (mostly 443 since Nextcloud basically won’t run over http). i.e., There shouldn’t be any difference in how Nextcloud is installed whether with snapd, with Nextcloud’s PHP installer or with a traditional tarball. IMO, in an environment like Virtualmin’s with so many moving parts, snap packages are useful only when there’s no other alternative; with Nextcloud there’s an easier alternative.

For the sub-domain format you’re using consider Virtualmin’s sub-server feature for Nextcloud if you aren’t using it already. This way, Nextcloud will have its own virtualhost config and DNS zone, and if SSL is issued separately from the parent domain renewals may go more smoothly with only one name to validate.

If you’re going to plow ahead with snaps try switching ports and everything else back to normal. If that’s not feasible you’ll want to get familiar with Nextcloud’s main .htaccess file in its root directory. There are strict security headers and redirects that may be obstacles to SSL and other things if anything about the web server isn’t standard stuff.

yo man snap have nothing to do with virtualmin… you better read docs or ask ubuntu folks…

You’re making it to complicated. Ive done this hundreds of times. Nextcloud snap installs everything needed. The machine then forwards all 80 and 443 to the snap install. All that other nonsense with apache outside of the snap is not needed and most likely the issue.

No need for apache server at all nor any apache redirects nor any apache settings in ubuntu itself.
sudo snap install nextcloud

Then browse to the ip of the machine port 80. Everything needed to run it is contained in the snap. Only thing to do afterword is firewall security if needed. Thats is done as normal in ubuntu itself. And https certificate settings are handled inside the snap by nextcloud. There’s a command to enable it for either self signed or lets encrypt. I forget what it was but search for nextcloud snap enable https.

Virtualmin is not going to interact with any domains or settings inside the snap. Webmin can still admin the server as normal, but will not have control over anything inside the snap.

Thanks for a proper explanation.

Thanks everyone for the replies and clarification. Still trying to wrap my head around the flow.

I have several other virtual hosts for the server that I can set up in virtualmin using sub domains. These will receive letsEncrypt certificates through Virtualmin (as does my my nexctloud.mydomin.com currently)
I assume that is my issue as I did not do an internal (snap) certificate as I already had one from virtualmin.

I will go ahead and complete the certificate for the nextcloud snap and see if I can access using the nextcloud.mydomain.com

Should I be removing the redirects I have added to my virtualhost (80, 443) in the sites-available/domain.conf file? I assume it is not needed as it is for the shared Apache webserver that virtualmin is administering?

Thanks again for the insights. time to do some more playing around.

I think you’re going to have to start over. The nextcloud snap is designed to turn the whole machine into a nextcloud host. If you then install the default apache server via virtualmin to host other sites, its going to conflict or you’re going to have to change one or the other to different ports. Both apaches can not listen/serve ports 80 and 443.
If you’re looking to host many domains along with nextcloud for those domains, best option is to start over with basic server, install virtualmin and let it manage it all. Then install nextcloud individually per domain in the webspace instead of using the snap.
I think you’re main issue is apache is technically trying to serve ports 80/443 in two different places.

1 Like

Okay, that was my next step if I could not get a snap to work. I just figured that since webmin runs on its own using its own port I could set the NextCloud snap installation up the same way just using its own port.

I’ll spend a little more time on it today when I get an opportunity but will probably just uninstall the snap and do a regular nextcloud installation in its own virtual server within Virtualmin.

I just figured that with the deployment of this snap setup, the developers of Webmin/Virtualmin would have a way to keep these installations integrated into their systems.

Thanks again for all the help

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