Allowed_admin_ranges stanza in config.php results in black screen of death

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 29.0.5): Nextcloud Hub 8 (29.0.6)
Operating system and version (eg, Ubuntu 24.04): FreeBSD 14.1-RELEASE-p3 GENERIC amd64
Apache or nginx version (eg, Apache 2.4.25): apache24-2.4.62
PHP version (eg, 8.3): php82-8.2.23

The issue you are facing:

Attempting to add the recommended security limitation for access to administration, I tried putting into config.php per:

https://docs.nextcloud.com/server/latest/Nextcloud_Server_Administration_Manual.pdf 4.9.5 (error, has a vestigial last comma)

and Hardening and security guidance — Nextcloud latest Administration Manual latest documentation
(error has vestigial last comma)

fairly close to Configuration Parameters — Nextcloud latest Administration Manual latest documentation allowed_admin_ranges (no vestigial comma - tested both, same result)

  'allowed_admin_ranges' => [
    '127.0.0.1/8',
    '10.0.0.1/8'
  ]

which black screen of death’s the instance and throws to httpd_error_log:

[Thu Sep 05 11:42:52.189542 2024] [proxy_fcgi:error] [pid 28306:tid 22261402789376] [remote 10.2.69.2:47494] AH01071: Got error 'PHP message: PHP Parse error:  syntax error, unexpected single-quoted string "maintenance", expecting ")" in /usr/local/www/nextcloud/config/config.php on line 52', referer: https://nas.blackrosetech.com/index.php/apps/files/preview-service-worker.js  in /usr/local/www/nextcloud/config/config.php on line 52'

removing the stanza restores operation. It seems we’re expecting a “)” or double quotes,

Is this the first time you’ve seen this error? (Y/N):

Steps to replicate it:

  1. Add the above satanza to config.php
  2. check the home page
  3. ooops

The output of your Nextcloud log in Admin > Logging:

No log entry is generated in the nextcloud log at level 3 but the page does not load

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

problematic stanza above

The output of your Apache/nginx/system log in /var/log/____:

Log entry above

Output errors in nextcloud.log in /var/www/ or as admin user in top right menu, filtering for errors. Use a pastebin service if necessary.

logs that were relevenat were included

For me it looks like you have forgotten to enter a comma or mixed-up brackets in your configuration file.

'allowed_admin_ranges' => [
    '127.0.0.1/8',
    '10.0.0.1/8'
  ]         <-- at least a comma should be added behind the closing bracket

The error is referring to the ‘maintenance’ parameter which you haven’t listed here. Please provide the full output of the “occ config:list” command to have a more detailed look on your configuration and the overal syntax.

2 Likes

I agree with @j-ed that your current issue is likely caused by a missing comma or similar.

That said, the manual you’re referencing is for the upcoming v30[1]. That feature isn’t in v29.

That isn’t the cause of your error though, since those lines would just be silently ignored in v29 (but they still have to be formatted properly to be parsed w/o getting an error).

[1] https://docs.nextcloud.com/

Trailing comma it was, thank you for the sharp eyes.

1 Like