Internal Server Error after working install

Hi, I’m getting an Internal Server Error when trying to connect to a fairly recent installation of Nextcloud. My install was working two days ago, and I was able to play around with a bit, upload some files, and install and activate the TOTP plugin.

I followed this guide to get this up and running initially: https://h3artbl33d.nl/communication/2018/10/07/nextcloud-openbsd/

My software and version information:

Operating System: OpenBSD 6.5
Web server: OpenBSD httpd
Database: PostgreSQL 11.2
PHP: 7.3
php_fpm: 7.3
redis: 4.0.14
Nextcloud: 16.0.1

Today, I get this error at the main page of the site:

Internal Server Error

The server encountered an internal error and was unable to complete your request.
Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.
More details can be found in the server log.

The only clue that I can find in server logs is this error in /var/www/logs/error.log:

PHP message: PHP Warning:  Unknown: failed to open stream: Undefined error: 0 in Unknown on line 0Unable to open primary script: /nextcloud (Permission denied)

I have verified that the ownership of /var/www/nextcloud is recursively set to www:www.

I have not encountered this error before today.

My Nextcloud config.php with unique info removed:

<?php
$CONFIG = array (
  'instanceid' => 'xxx',
  'passwordsalt' => 'xxx',
  'secret' => 'xxx',
  'trusted_domains' =>
  array (
    0 => 'nc.my.domain',
  ),
  'datadirectory' => '/nextcloud/data',
  'dbtype' => 'pgsql',
  'version' => '16.0.1.1',
  'overwrite.cli.url' => 'https://nc.my.domain',
  'dbname' => 'nextcloud',
  'dbhost' => '127.0.0.1:5432',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'nextcloud',
  'dbpassword' => 'xxx',
  'installed' => true,
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => '127.0.0.1',
    'port' => 6379,
  ),
  'twofactor_enforced' => 'true',
  'twofactor_enforced_groups' =>
  array (
  ),
  'twofactor_enforced_excluded_groups' =>
  array (
  ),
);

Thanks in advance for your help!

just to try it: have you already tried to disable TOTP again and see what happens?

dunno about what your installation-guide told you but usally the webuser is set to www-data:www-data (if your installaionguid told you to call it www:www pls don’t change it)

just to try it: have you already tried to disable TOTP again and see what happens?

I think I would need to do this using the Nextcloud occ command. On OpenBSD, I don’t think it’s possible to execute a command as the www user. First, the account shell is set to /sbin/nologin. Second, if you change the account’s shell to an interactive shell such as ksh, you are unable to execute commands when you become that user. There may be a way around that, but that’s where my knowledge ran out.

It doesn’t seem like disabling this plugin would have any effect, as everything was working with this plugin a few days ago.

dunno about what your installation-guide told you but usally the webuser is set to www-data:www-data (if your installaionguid told you to call it www:www pls don’t change it)

OpenBSD doesn’t use www-data user or group.

Thanks for the suggestions.

1 Like

I would assume, this problem has muliple layers. At the time of your posting, most likely the matching Redis version was not yet available. You can check with:

nextcloud# pkg_info -Q pecl | grep redis
pecl71-redis-4.3.0
pecl72-redis-4.3.0
pecl73-redis-4.3.0

In terms of a workaround, you can edit /var/www/nextcloud/config/config.php and change the lines as follows:

// ‘memcache.local’ => ‘\OC\Memcache\APC’,
// ‘memcache.distributed’ => ‘\OC\Memcache\Redis’,
‘memcache.locking’ => ‘\OC\Memcache\Redis’,
‘redis’ => array(
‘host’ => ‘127.0.0.1’,
‘port’ => 6379,
),

Then restart PHP and HTTPD.

buzz# pkg_info -Q pecl | grep redis
pecl71-redis-4.3.0
pecl72-redis-4.3.0
pecl73-redis-4.3.0 (installed)

In /var/www/nextcloud/config/config.php, I have:

  'memcache.local' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => '127.0.0.1',
    'port' => 6379,
  ),

This seems to be in line with what you’ve posted. Is it not necessary to escape the backslashes with \? I tried commenting out my ‘memcache.local’ line and restarting PHP and HTTPD. Still not working.

EDIT: I also tried not escaping the \'s, but it didn’t fix anything.

I would not use Nextcloud on a system where the occ command can’t be used. Are you sure you can’t?

Have you checked the webserver logs? I’m not sure about OpenBSD. I run Ubuntu Server, and Apache has a separate log folder.

The key idea was to comment the mentioned lines rather than deleting them. For one reason or another this has removed the error message. However, Redis is then deactivated.

I have another box running PHP7.2 with an almost identical configuration running perfectly fine.

Yes, I tried commenting out the ‘memcache.local’ line and restarting services. No change in behavior. My lines of the file were as you showed, except I am missing the memcache.distributed line completely.

I think I will attempt to get in touch with the author of the blog post I followed to set this up. Thanks to everyone for the help.

Hi!

Stumbled upon the exact same error as you, finally. Did you ask and receive a response from the author of the post? Or did you find a solution, basically, is what I am asking. :slight_smile:

Sorry for the delayed response. I ended up updating my packages and going through the steps of the blog post again. I deleted and recreated the nextcloud db, and I ended up with a working installation again. I then made the modification to nextcloud config/config.php described here: https://h3artbl33d.nl/tech/2019/05/01/fixing-nextcloud-chroot/

I also learned that the occ command can be run on OpenBSD using:

doas -u www /usr/local/bin/php-7.3 /var/www/nextcloud/occ

Hopefully this install remains stable. I’ll provide an update if it fails again.