How can I make sure that the Apache in my snap installation is working?

Hi there.

Long story short:
Nextcloud stopped working after touching the Apache configuration files. The login website no longer loads. I have an Ubuntu snap installation. I am not familiar with snaps, so I do not know how to check if the Apache service up and if the configuration files are correct. How do I check this in a snap?

Long story long:
I was trying to renew my Let’s Encrypt certificate with the

certbot renew

command when I got an error that pointed towards a line in my

nextcloud.conf

file inside the Apache folder. I started fiddling with the configuration files in the

/etc/apache2/sites-available/

and

/etc/ssl/

folders so they would point to the correct certificate files. I must have done something right, as I managed to renew the certificate, but I have messed something else up in the process as my Nextcloud login page no longer loads. I decided to reboot my system because that is what you do when you have much of a clue of what you are doing, but after the restart the Apache default page showed up instead of Nextcloud. I read on this forum that if you have an Ubuntu snap installation then the Apache service must be stopped as it will enter in conflict with the Apache running in the snap, so following someone’s instructions I stopped the Apache service with

service apache2 stop

and made sure it will not restart with

sudo update-rc.d apache2 disable

This did not play the trick for me, my Nextcloud login page still does not load. I guess that I may have messed something up in the Apache configuration files or somewhere else, I do not recall all the steps I followed and the commands I run. When I was modifying the config files I was unaware that the snap installation was running its own Apache instance and that it could interfere with Ubuntu’s Apache service, so now I wonder: do the Apache configuration files stored at

/etc/apache2/sites-available/

affect the Apache instance running in the snap? How does that work? If they are separate instances then shouldn’t matter what I did to the Apache configuration files and most probably the problem shall be somewhere else, correct? How can I check if the Apache in the snap is up and running and where can I find its configuration files?

I had a look at the contents of the folder /var/snap/ but I did not find anything that resembles the Apache configuration files. Inside /var/www/html/ all I found was the Apache detault index.html page, there is no Nextcloud folder (should there be one?). Am I missing something?

Thanks in advance.

Then you can use a normal installation you also not familiar with :wink:

Here the services:

snap services

Learn something about Snap
https://www.freecodecamp.org/news/managing-ubuntu-snaps/
or Linux or search a hosted nextcloud. If your data is important you should able to restore all data on data loss (hdd breaks, error, …)

I think there is also something with apache2/lets encrypt and/or certbot und you must use it with Snap and not direct in your linux system.

apache2 is not snap apache2
nextcloud is not snap nextcloud
i think certbot is also not snap certbot

Sorry. I use no Ubuntu and no Snap.

I thought a snap installation would make my life easier. I see I was wrong. I start to regret it now.

Perhaps you can make it all new.
But i do not know if you can restore data and database from snap-backup for normal-restore.

https://docs.nextcloud.com/server/19/admin_manual/maintenance/backup.html
https://docs.nextcloud.com/server/19/admin_manual/maintenance/restore.html

Test it on a test server.

Nice installation guide for Debian 10.
I think with newest Ubuntu 20.04 LTS it does not differ much.

https://www.howtoforge.com/tutorial/how-to-install-nextcloud-on-debian-10

Perhaps you can use parts of this with Ubuntu 20.04 LTS or change to Debian Buster :wink:

https://www.howtoforge.com/tutorial/ubuntu-nginx-nextcloud/

Thanks for the tips. I will use the reinstall as a last resort. Trying to revive my machine I did a:

snap services

All services are active except for lxd. Apache is running, which is what I wanted to confirm. Next I did:

sudo snap logs nextcloud

And found a syntax error in ssl.conf that points to the following line (it claims the file does not exist):

SSLCertificateFile      ${SNAP_DATA}/certs/live/cert.pem

I tried to edit the line so it would point to my Let’s Encrypt certificate:

/etc/letscrypt/live/REACTED/cert.pem

The ssl.conf file is only readable and the folder the conflictive line points to seems to be a temporary only readable folder, so I can’t force copying my certificates in there either. Should I play with the permissions of the ssl.conf file or the temporary folder it currently it’s pointing to, is there a command for tell the snap where my SSL certificates live, or am I just digging my grave deeper and I should simply reinstall?

Perhaps read again:
https://www.freecodecamp.org/news/managing-ubuntu-snaps/

The actual .snap files are kept in the /var/lib/snapd/snaps/ directory. When running, those files will be mounted within the root directory /snap/

Sorry i hate Snap.
I have too less know how for Snap. Sorry.