
How do I set NEXTCLOUD_CONFIG_DIR in the shell environment for CLI invocations
Edit: the good souls at the Nextcloud Community forum were able to solve this. Turns out that sudo clears the environment unless you use -E option. So after running the export command, you have to call occ with sudo -E -u www-data php occ
I'm currently implementing some server hardening steps and, following https://docs.nextcloud.com/server/latest/admin_manual/installation/harden_server.html#place-config-directory-outside-of-the-web-root, I've placed my config directory outside of the web root in /etc/nextcloud. Site is up and running, but what I haven't figured out yet is how to set the config dir in the shell environment. The documentation just gives this command:
export NEXTCLOUD_CONFIG_DIR=/etc/nextcloud
but doesn't specify where to run it. Can anybody help?
System config is:
- Nextcloud Hub 26 Spring (34.0.3)
- Linux 6.12.47+rpt-rpi-v8 aarch64
- PHP 8.3.17
- mysql 11.7.2
Many thanks!