Some solutions to errors on a Synology NAS installation of Nextcloud

Some solutions to various issues which occur when updating/installing a standard installation of Nextcloud on a Synology NAS. All entered in an ssh terminal after issuing sudo -i:

To update missing indexes enter this command, substituting your php.id in place of my semi-hidden one:

sudo -u http /usr/local/bin/php70 -c /var/packages/WebStation/etc/php_profile/9f1e642a-0d20-4664-8934-cxxxxxxxxxe/conf.d/user_settings.ini -f /volume1/web/nextcloud/occ db:add-missing-indices

sudo -u http /usr/local/bin/php70 -c /var/packages/WebStation/etc/php_profile/9f1e642a-0d20-4664-8934-cxxxxxxxxxee/conf.d/user_settings.ini -f /volume1/web/nextcloud/occ db:convert-filecache-bigint

The php profile id is unique to each installation

To update Strict-Transport-Security:

echo ‘add_header Strict-Transport-Security “max-age=31536000; includeSubDomains” always;’ > /etc/nginx/conf.d/http.hsts.conf

To update caching:

edit /volume1/web/nextcloud/config/config.php and add:
'memcache.local' => '\OC\Memcache\APCu',

To solve ocs and ocm provider errors:

ln -s /var/services/web/nextcloud/ocm-provider/ /var/services/web
ln -s /var/services/web/nextcloud/ocs-provider/ /var/services/web

The last solution took me hours and hours to solve, but was so simple! I had been trying to link using /volume1/web but for some reason it required the ‘real’ location of /var/services/web

Hope this helps someone!

2 Likes

Great information.

The line to be added to update cacheing contains smart quotes and will give a server error when cut/pasted. The correct content is:

'memcache.local' => '\OC\Memcache\APCu',

To get the right php profile I use a /usr/local/bin/occ script as follows:

#!/bin/sh
cd /var/services/web/nextcloud
sudo -u http \
  /usr/local/bin/php70 -c /usr/syno/etc/packages/WebStation/php_profile/94dd65f5-1908-4982-bb5c-df064638a869/conf.d/user_settings.ini \
  occ ${1+"$@"}

I also have a spksrc branch to build a nextcloud package for easy install.

1 Like

Thank you sciurius. I have edited my post to correct the smart quotes in case someone doesn’t read this thread any further.

What is a spksrc branch?

spksrc is the build environment of the Synology Community, where community packages are built.
https://synocommunity.com/

1 Like

This seems to cause problems when nginx is restarted.
“DSM cannot start up normally because it ran into a problem. Please contact the Synology support team for help.”

I run Nextcloud as a virtual host in WebStation. Checking HSTS in the config works.

I’ve not had this problem - since I incorporated this fix I have restarted nginx manually several times for various reasons and have rebooted my DS a few times too. Not once has it complained. I installed NextCloud directly, no virtual host or anything like that. If you copied and pasted the fix double check that the correct quotes have survived me posting and you copying - I know this has caused problems in the past.

Lol! Just re-red the thread and it was you who commented about the quotes in another fix. Maybe it’s the issue for this one too.

Tried again, and this time it works. :face_with_raised_eyebrow:
Probably a typo.

What happens: normally nginx runs as

/usr/bin/nginx -g "pid /run/nginx.pid; daemon on; master_process on;"

With an error in /etc/nginx/conf.d/http.hsts.conf this becomes:

/usr/bin/nginx -c /etc.defaults/nginx/nginx.conf.default -g "pid /run/nginx.pid; daemon on; master_process on;"

Don’t know why, but now we know… :grin:

1 Like

Hello

I am new to the matter. How can I find out the php.id? maybe others have the same question.