SNAP Installation change php, apache and nextcloud configs

Hello,

I Installed nextCloud with SNAP and all is really running fine. Great software.

But when I try to made some minor changes on apache, php or nextcloud config … I don´t finde the files.

So please has someone the answer for:

  1. Where is the apache conf and how restart apache?
  2. Where is the php.conf and how restart php service?
  3. Where is the nextcloud conf and how restart nextcloud?
  4. Where is the www root folder to add some other html/php files?

Thank you!

2 Likes

Hello! Always glad to see people wanting to tinker with Nextcloud, but you’ll probably need to switch from the snap to a more traditional install if you want to dig into it. If you’re looking at running non-Nextcloud things along-side an unmodified Nextcloud, then adding a “reverse proxy” to your setup might be your thing.

Why?
Snaps are designed to have a limited interface for configuration (here is Nextcloud’s). Powerful (and easily misconfigured) conf files are set up in a way that works best for the most users , and are a read-only part of the snap image.
Edit: See the responses from @kyrofa and @PritishSehzpaul below. The snap is designed so that the config file can be edited, after all. You can also modify the snap itself, though this goes against the point of packaging it as a snap in the first place.

What can I do without complicating things?
For most uses, you’ll be able to do what you need using the above snap interface (for example, configuring trusted names and SSL). If you’re looking at adding custom HTML pages (not Nextcloud apps?), you might need a bit more configurable of a solution. Two options below.

I might want to play around with these things. How?
If you’re on the fence about switching to classic install, have a look at the article “Snap or VM?” in the that same wiki. You can check out the install script in the VM repo, or manually install on the server of your choice (docs).

I really just want to be able to run another webapp or serve static files on the same server
You’ll need to set up another web server process (Apache, nginx, etc) outside the snap. It can be on the host server, inside a VM, or anywhere else that can reach your Nextcloud snap and be reached by your end users.
You can modify php parameters and everything else you need for your other app(s), then have it forward Nextcloud requests through to your Nextcloud snap (this could make your Nextcloud url http://mysite/nextcloud rather than just http://mysite, for example, depending how you set it up).
There are lots of tutorials about this, but here’s a quick one from DigitalOcean: Use Apache as Reverse Proxy using mod_proxy. You can substitute apt where they use aptitude, it does the same thing for those commands, and is installed by default on recent Ubuntu.


Answers to those specific questions
They’re all read-only, but here’s where things live:

  1. /snap/nextcoud/current/conf/httpd.conf.
    You can restart the Apache server using snapd's tooling:
    sudo snap restart nextcloud.apache
  2. /snap/nextcloud/current/config/php/php.ini
    There isn’t a php daemon as such in this configuration - looks like it is run per-request, so you wouldn’t even need to restart Apache to apply any changes. Just reload/refresh the page.
  3. /snap/nextcloud/current/htdocs/config/config.php
    Nextcloud doesn’t have a daemon at all, it’s all just php. See above.
  4. /snap/nextcloud/current/htdocs/
1 Like

Sorry for reviving an old thread. Just wanted to mention that this config is read-only, yes, but it’s only there to be installed by the snap in a read/write place, which is in /var/snap/nextcloud/current/nextcloud/config/config.php. That config is editable (Nextcloud with a read-only config is indeed quite limited).

More information is available in the Configuration section of the README.

2 Likes

previewgenerator need
Important : To enable pre-generation of previews you must add php /var/www/nextcloud/occ preview:pre-generate to a system cron job that runs at times of your choosing.

how to active it under snap please?

I know this is probably late and I haven’t tried it yet but this could be useful.


The above article states how to open the snap in a writable mode.

1 Like