Nextcloudpi does not work after reboot

Nextcloud version:12.0.3
Operating system and version : Latest nextcloudpi image
Apache or nginx version : Apache 2.4.25
PHP version :PHP 7.0.19-1
Is this the first time you’ve seen this error?:
Yes
Can you reliably replicate it? (If so, please outline steps):
Once I first boot the raspberry it runs without errors but when I set it up and reboot I can not connect through the web browser (locally or over intenet). It says
This page isn’t working

localraspberryip is currently unable to handle this request.
HTTP ERROR 500

ssh works normally

The output of your Nextcloud log in Admin > Logging:
I can not login

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

$CONFIG = array (
  'passwordsalt' => '**************',
  'secret' => '***********************',
  'trusted_domains' => 
  array (
    0 => 'localhost',
    5 => 'nextcloudpi.local',
    1 => '192.168.1.3',
  ),
  'datadirectory' => '/media/USBdrive/ncdata',
  'overwrite.cli.url' => 'https://192.168.1.3',
  'dbtype' => 'mysql',
  'version' => '12.0.3.3',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'ncadmin',
  'dbpassword' => 'cZhQnzKAvjaYAelcf0ffN8*qOCpqmLx',
  'installed' => true,
  'instanceid' => 'ocblr2m190u4',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'mail_smtpmode' => 'php',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_from_address' => 'admin',
  'mail_domain' => 'ownyourbits.com',
  'overwriteprotocol' => 'https',
  'maintenance' => false,
);

The output of your Apache/nginx/system log in /var/log/error.log: please notice that I installed it today 1/10 and the logs starts from 27/9

[Wed Sep 27 22:17:40.307038 2017] [mpm_event:notice] [pid 1225:tid 3069847568] AH00489: Apache/2.4.25 (Raspbian) configured -- resuming normal operations
[Wed Sep 27 22:17:40.355965 2017] [core:notice] [pid 1225:tid 3069847568] AH00094: Command line: '/usr/sbin/apache2'
[Wed Sep 27 22:46:23.501618 2017] [mpm_event:notice] [pid 1225:tid 3069847568] AH00491: caught SIGTERM, shutting down
[Wed Sep 27 22:50:24.399825 2017] [mpm_event:notice] [pid 467:tid 3069996128] AH00489: Apache/2.4.25 (Raspbian) OpenSSL/1.0.2l configured -- resuming normal operations
[Wed Sep 27 22:50:24.479193 2017] [core:notice] [pid 467:tid 3069996128] AH00094: Command line: '/usr/sbin/apache2'
[Wed Sep 27 22:54:57.177856 2017] [mpm_event:notice] [pid 467:tid 3069996128] AH00491: caught SIGTERM, shutting down
[Wed Sep 27 22:59:06.241852 2017] [mpm_event:notice] [pid 481:tid 3069652064] AH00489: Apache/2.4.25 (Raspbian) OpenSSL/1.0.2l configured -- resuming normal operations
[Wed Sep 27 22:59:06.259653 2017] [core:notice] [pid 481:tid 3069652064] AH00094: Command line: '/usr/sbin/apache2'
[Wed Sep 27 23:02:46.605405 2017] [mpm_event:notice] [pid 481:tid 3069652064] AH00491: caught SIGTERM, shutting down
[Wed Sep 27 23:06:53.872637 2017] [mpm_event:notice] [pid 485:tid 3069357152] AH00489: Apache/2.4.25 (Raspbian) OpenSSL/1.0.2l configured -- resuming normal operations
[Wed Sep 27 23:06:53.933502 2017] [core:notice] [pid 485:tid 3069357152] AH00094: Command line: '/usr/sbin/apache2'
.................................................................................
[Sun Oct 01 14:47:15.422484 2017] [authz_host:error] [pid 941:tid 1843319856] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /green-circle.svg failed, reason: unable to get the remote host name, referer: https://192.168.1.3:4443/ncp.css
[Sun Oct 01 15:03:34.054016 2017] [authz_host:error] [pid 941:tid 1834931248] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:03:34.237898 2017] [authz_host:error] [pid 941:tid 1834931248] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:03:34.245846 2017] [proxy_fcgi:error] [pid 941:tid 1834931248] [client 192.168.1.157:56170] AH01071: Got error 'PHP message: PHP Notice:  Undefined variable: checked in /var/www/ncp-web/ncp-launcher.php on line 46\n'
[Sun Oct 01 15:09:00.740791 2017] [authz_host:error] [pid 941:tid 1826542640] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:09:00.895130 2017] [authz_host:error] [pid 941:tid 1826542640] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:09:00.897555 2017] [proxy_fcgi:error] [pid 941:tid 1826542640] [client 192.168.1.157:56170] AH01071: Got error 'PHP message: PHP Notice:  Undefined variable: checked in /var/www/ncp-web/ncp-launcher.php on line 46\n'
[Sun Oct 01 15:09:06.304699 2017] [authz_host:error] [pid 941:tid 1818154032] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:09:06.485230 2017] [authz_host:error] [pid 941:tid 1818154032] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:09:06.487323 2017] [proxy_fcgi:error] [pid 941:tid 1818154032] [client 192.168.1.157:56170] AH01071: Got error 'PHP message: PHP Notice:  Undefined variable: checked in /var/www/ncp-web/ncp-launcher.php on line 46\n'
[Sun Oct 01 15:09:08.481342 2017] [authz_host:error] [pid 941:tid 1809765424] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:09:08.625246 2017] [authz_host:error] [pid 941:tid 1809765424] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:09:12.315808 2017] [authz_host:error] [pid 941:tid 1801376816] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:09:12.491940 2017] [authz_host:error] [pid 941:tid 1801376816] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:09:12.494145 2017] [proxy_fcgi:error] [pid 941:tid 1801376816] [client 192.168.1.157:56170] AH01071: Got error 'PHP message: PHP Notice:  Undefined variable: checked in /var/www/ncp-web/ncp-launcher.php on line 46\n'
[Sun Oct 01 15:09:17.886646 2017] [authz_host:error] [pid 941:tid 1784599600] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:09:18.031723 2017] [authz_host:error] [pid 941:tid 1784599600] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:09:22.083254 2017] [authz_host:error] [pid 941:tid 1985926192] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:09:22.233419 2017] [authz_host:error] [pid 941:tid 1985926192] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:09:22.235240 2017] [proxy_fcgi:error] [pid 941:tid 1985926192] [client 192.168.1.157:56170] AH01071: Got error 'PHP message: PHP Notice:  Undefined variable: checked in /var/www/ncp-web/ncp-launcher.php on line 46\n'
[Sun Oct 01 15:09:27.005375 2017] [authz_host:error] [pid 941:tid 1977537584] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:09:27.148355 2017] [authz_host:error] [pid 941:tid 1977537584] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:09:30.131775 2017] [authz_host:error] [pid 941:tid 1792988208] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:09:30.314073 2017] [authz_host:error] [pid 941:tid 1792988208] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:09:30.316294 2017] [proxy_fcgi:error] [pid 941:tid 1792988208] [client 192.168.1.157:56170] AH01071: Got error 'PHP message: PHP Notice:  Undefined variable: checked in /var/www/ncp-web/ncp-launcher.php on line 46\nPHP message: PHP Notice:  Undefined variable: checked in /var/www/ncp-web/ncp-launcher.php on line 46\n'
[Sun Oct 01 15:09:32.292213 2017] [authz_host:error] [pid 941:tid 1943983152] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:09:32.449340 2017] [authz_host:error] [pid 941:tid 1943983152] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:09:33.291988 2017] [authz_host:error] [pid 941:tid 1960760368] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:09:33.454560 2017] [authz_host:error] [pid 941:tid 1960760368] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:09:33.456736 2017] [proxy_fcgi:error] [pid 941:tid 1960760368] [client 192.168.1.157:56170] AH01071: Got error 'PHP message: PHP Notice:  Undefined variable: checked in /var/www/ncp-web/ncp-launcher.php on line 46\nPHP message: PHP Notice:  Undefined variable: checked in /var/www/ncp-web/ncp-launcher.php on line 46\n'
[Sun Oct 01 15:09:38.557475 2017] [authz_host:error] [pid 941:tid 1935594544] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:09:38.733738 2017] [authz_host:error] [pid 941:tid 1935594544] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:09:38.735767 2017] [proxy_fcgi:error] [pid 941:tid 1935594544] [client 192.168.1.157:56170] AH01071: Got error 'PHP message: PHP Notice:  Undefined variable: checked in /var/www/ncp-web/ncp-launcher.php on line 46\n'
[Sun Oct 01 15:09:39.731944 2017] [authz_host:error] [pid 941:tid 1969148976] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:09:39.909825 2017] [authz_host:error] [pid 941:tid 1969148976] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:09:46.904338 2017] [authz_host:error] [pid 941:tid 1952371760] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:09:47.075747 2017] [authz_host:error] [pid 941:tid 1952371760] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:09:51.786083 2017] [authz_host:error] [pid 941:tid 1927205936] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:09:51.959225 2017] [authz_host:error] [pid 941:tid 1927205936] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:09:53.973887 2017] [authz_host:error] [pid 941:tid 1918817328] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:09:54.154703 2017] [authz_host:error] [pid 941:tid 1918817328] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:10:30.866201 2017] [authz_host:error] [pid 941:tid 1902040112] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:10:31.030375 2017] [authz_host:error] [pid 941:tid 1902040112] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:10:40.190960 2017] [authz_host:error] [pid 941:tid 1910428720] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:10:40.350499 2017] [authz_host:error] [pid 941:tid 1910428720] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:10:59.974293 2017] [authz_host:error] [pid 941:tid 1885262896] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:11:00.158395 2017] [authz_host:error] [pid 941:tid 1885262896] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:11:02.233491 2017] [authz_host:error] [pid 941:tid 1893651504] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:11:02.389735 2017] [authz_host:error] [pid 941:tid 1893651504] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:11:26.485164 2017] [authz_host:error] [pid 941:tid 1868485680] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:11:26.598561 2017] [authz_host:error] [pid 941:tid 1868485680] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:11:29.217180 2017] [authz_host:error] [pid 941:tid 1860097072] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:11:29.331074 2017] [authz_host:error] [pid 941:tid 1860097072] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:12:19.901168 2017] [authz_host:error] [pid 941:tid 1851708464] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:12:20.089390 2017] [authz_host:error] [pid 941:tid 1851708464] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:12:20.091301 2017] [proxy_fcgi:error] [pid 941:tid 1851708464] [client 192.168.1.157:56170] AH01071: Got error 'PHP message: PHP Notice:  Undefined variable: checked in /var/www/ncp-web/ncp-launcher.php on line 46\n'
[Sun Oct 01 15:12:25.677818 2017] [authz_host:error] [pid 941:tid 1843319856] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:12:25.844456 2017] [authz_host:error] [pid 941:tid 1843319856] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:12:28.391814 2017] [authz_host:error] [pid 941:tid 1834931248] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:12:28.540337 2017] [authz_host:error] [pid 941:tid 1834931248] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:12:28.542374 2017] [proxy_fcgi:error] [pid 941:tid 1834931248] [client 192.168.1.157:56170] AH01071: Got error 'PHP message: PHP Notice:  Undefined variable: checked in /var/www/ncp-web/ncp-launcher.php on line 46\n'
[Sun Oct 01 15:12:36.005243 2017] [authz_host:error] [pid 941:tid 1826542640] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:12:36.163534 2017] [authz_host:error] [pid 941:tid 1826542640] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:12:38.288569 2017] [authz_host:error] [pid 941:tid 1818154032] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:12:38.445271 2017] [authz_host:error] [pid 941:tid 1818154032] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:12:39.200167 2017] [authz_host:error] [pid 941:tid 1809765424] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:12:39.360860 2017] [authz_host:error] [pid 941:tid 1809765424] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:12:59.304580 2017] [authz_host:error] [pid 941:tid 1801376816] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:12:59.469119 2017] [authz_host:error] [pid 941:tid 1801376816] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:13:37.852936 2017] [authz_host:error] [pid 941:tid 1784599600] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:13:38.023532 2017] [authz_host:error] [pid 941:tid 1784599600] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:13:40.536694 2017] [authz_host:error] [pid 941:tid 1985926192] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:13:40.725311 2017] [authz_host:error] [pid 941:tid 1985926192] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:13:46.224270 2017] [proxy_fcgi:error] [pid 941:tid 1985926192] [client 192.168.1.157:56170] AH01071: Got error 'PHP message: PHP Notice:  Undefined variable: params in /var/www/ncp-web/ncp-launcher.php on line 86\nPHP message: PHP Warning:  Invalid argument supplied for foreach() in /var/www/ncp-web/ncp-launcher.php on line 86\n'
[Sun Oct 01 15:13:48.350644 2017] [authz_host:error] [pid 941:tid 1977537584] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:13:48.529495 2017] [authz_host:error] [pid 941:tid 1977537584] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:13:53.630908 2017] [authz_host:error] [pid 941:tid 1792988208] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:13:53.772621 2017] [authz_host:error] [pid 941:tid 1792988208] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:13:53.774845 2017] [proxy_fcgi:error] [pid 941:tid 1792988208] [client 192.168.1.157:56170] AH01071: Got error 'PHP message: PHP Notice:  Undefined variable: checked in /var/www/ncp-web/ncp-launcher.php on line 46\n'
[Sun Oct 01 15:13:58.275922 2017] [authz_host:error] [pid 941:tid 1943983152] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:13:58.458453 2017] [authz_host:error] [pid 941:tid 1943983152] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:13:58.460490 2017] [proxy_fcgi:error] [pid 941:tid 1943983152] [client 192.168.1.157:56170] AH01071: Got error 'PHP message: PHP Notice:  Undefined variable: checked in /var/www/ncp-web/ncp-launcher.php on line 46\n'
[Sun Oct 01 15:14:04.764488 2017] [authz_host:error] [pid 941:tid 1960760368] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:14:04.947627 2017] [authz_host:error] [pid 941:tid 1960760368] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:14:04.949744 2017] [proxy_fcgi:error] [pid 941:tid 1960760368] [client 192.168.1.157:56170] AH01071: Got error 'PHP message: PHP Notice:  Undefined variable: checked in /var/www/ncp-web/ncp-launcher.php on line 46\n'
[Sun Oct 01 15:14:27.382340 2017] [authz_host:error] [pid 941:tid 1935594544] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:14:27.571927 2017] [authz_host:error] [pid 941:tid 1935594544] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:14:27.574072 2017] [proxy_fcgi:error] [pid 941:tid 1935594544] [client 192.168.1.157:56170] AH01071: Got error 'PHP message: PHP Notice:  Undefined variable: checked in /var/www/ncp-web/ncp-launcher.php on line 46\n'
[Sun Oct 01 15:14:30.985495 2017] [authz_host:error] [pid 941:tid 1969148976] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:14:31.136189 2017] [authz_host:error] [pid 941:tid 1969148976] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:14:31.138285 2017] [proxy_fcgi:error] [pid 941:tid 1969148976] [client 192.168.1.157:56170] AH01071: Got error 'PHP message: PHP Notice:  Undefined variable: checked in /var/www/ncp-web/ncp-launcher.php on line 46\n'
[Sun Oct 01 15:19:42.135319 2017] [authz_host:error] [pid 941:tid 1952371760] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:19:42.288704 2017] [authz_host:error] [pid 941:tid 1952371760] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:19:44.966912 2017] [authz_host:error] [pid 941:tid 1927205936] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:19:45.108140 2017] [authz_host:error] [pid 941:tid 1927205936] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:19:57.859671 2017] [authz_host:error] [pid 941:tid 1918817328] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:19:58.013571 2017] [authz_host:error] [pid 941:tid 1918817328] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:20:09.310004 2017] [authz_host:error] [pid 941:tid 1902040112] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:20:09.459189 2017] [authz_host:error] [pid 941:tid 1902040112] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:20:10.186932 2017] [authz_host:error] [pid 941:tid 1910428720] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:20:10.368504 2017] [authz_host:error] [pid 941:tid 1910428720] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:20:10.370744 2017] [proxy_fcgi:error] [pid 941:tid 1910428720] [client 192.168.1.157:56170] AH01071: Got error 'PHP message: PHP Notice:  Undefined variable: checked in /var/www/ncp-web/ncp-launcher.php on line 46\n'
[Sun Oct 01 15:29:25.548303 2017] [authz_host:error] [pid 941:tid 1885262896] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:29:25.724282 2017] [authz_host:error] [pid 941:tid 1885262896] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:29:27.555176 2017] [authz_host:error] [pid 941:tid 1893651504] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:29:27.729301 2017] [authz_host:error] [pid 941:tid 1893651504] [client 192.168.1.157:56170] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Sun Oct 01 15:29:27.731353 2017] [proxy_fcgi:error] [pid 941:tid 1893651504] [client 192.168.1.157:56170] AH01071: Got error 'PHP message: PHP Notice:  Undefined variable: checked in /var/www/ncp-web/ncp-launcher.php on line 46\n'
[Sun Oct 01 15:37:59.896465 2017] [mpm_event:notice] [pid 824:tid 1992790016] AH00491: caught SIGTERM, shutting down
[Sun Oct 01 18:38:13.236534 2017] [ssl:warn] [pid 621:tid 1992613888] AH01909: localhost:4443:0 server certificate does NOT include an ID which matches the server name
[Sun Oct 01 18:38:14.044443 2017] [ssl:warn] [pid 878:tid 1992613888] AH01909: localhost:4443:0 server certificate does NOT include an ID which matches the server name
[Sun Oct 01 18:38:15.003271 2017] [mpm_event:notice] [pid 878:tid 1992613888] AH00489: Apache/2.4.25 (Raspbian) OpenSSL/1.0.2l configured -- resuming normal operations
[Sun Oct 01 18:38:15.003433 2017] [core:notice] [pid 878:tid 1992613888] AH00094: Command line: '/usr/sbin/apache2'

I give you the ncp-output.php

<?php
///
// Dispatcher of SSE events with the contents of the NCP log
//
// Copyleft 2017 by Ignacio Nunez Hernanz <nacho _a_t_ ownyourbits _d_o_t_ com>
// GPL licensed (see end of file) * Use at your own risk!
//
// More at https://ownyourbits.com/2017/02/13/nextcloud-ready-raspberry-pi-image/
///

header('Content-Type: text/event-stream; charset=utf-8');
header('Cache-Control: no-cache'); // recommended to prevent caching of event data.


/**
 * Constructs the SSE data format and flushes that data to the client.
 * ( from html5rocks.com )
 *
 * @param string $id Timestamp/id of this connection.
 * @param string $msg Line of text that should be transmitted.
 */
function sendMsg($id, $msg) 
{
  echo "id: $id"    . PHP_EOL;
  echo "data: $msg" . PHP_EOL;
  echo PHP_EOL;
  ob_flush();
  flush();
}

/**
 * Pings the client-browser to force detection of closed socket
 */
function pingClient()
{
  echo ' ';
  ob_flush();
  flush();
}

/**
 * Imitates 'tail --follow' functionality, and sends lines as SSE events
 * , while pinging browser to detect closed tab.
 * ( based on stack overflow )
 */
function follow($file)
{
  $size = 0;
  while (true) 
  {
    clearstatcache();
    $currentSize = filesize($file);
    if ($size == $currentSize) 
    {
      usleep(200000); // 0.2s
      // if the user refreshes the tab >5 times, it won't load because it doesn't detect closed socket 
      // , and all workers are in use
      pingClient();   
      continue;
    }

    $fh = fopen($file, "r");
    fseek($fh, $size);

    while ($line = fgets($fh)) 
      sendMsg( 'output' , $line );

    fclose($fh);
    $size = $currentSize;
  }
}

session_write_close();
echo str_pad('',1024*1024*4); // make sure the browser buffer becomes full
follow( '/run/ncp.log' );

// License
//
// This script is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This script is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this script; if not, write to the
// Free Software Foundation, Inc., 59 Temple Place, Suite 330,
// Boston, MA  02111-1307  USA
?>

and the ncp-launcher.php

<?php 
///
// NextcloudPi Web Panel backend
//
// Copyleft 2017 by Ignacio Nunez Hernanz <nacho _a_t_ ownyourbits _d_o_t_ com>
// GPL licensed (see end of file) * Use at your own risk!
//
// More at https://ownyourbits.com/2017/02/13/nextcloud-ready-raspberry-pi-image/
///

include ('csrf.php');

session_start();
ignore_user_abort( true );

if ( $_POST['action'] == "cfgreq" ) 
{
  if ( !$_POST['ref'] ) exit( '{ "output": "Invalid request" }' );

  //CSFR check
  $token = isset($_POST['csrf_token']) ? $_POST['csrf_token'] : '';
  if ( empty($token) || !validateCSRFToken($token) )
    exit( '{ "output": "Unauthorized request. Try reloading the page" }' );

  $path  = '/usr/local/etc/nextcloudpi-config.d/';
  $files = array_diff(scandir($path), array('.', '..'));

  $fh    = fopen( $path . $_POST['ref'] . '.sh' ,'r')
             or exit( '{ "output": "' . $file . ' read error" }' );

  // Get new token
  echo '{ "token": "' . getCSRFToken() . '",';
  echo ' "output": ';

  $output = "<table>";

  while ( $line = fgets($fh) ) 
  {
    // checkbox (yes/no) field
    if ( preg_match('/^(\w+)_=(yes|no)$/', $line, $matches) )
    {
      if ( $matches[2] == "yes" )
        $checked = "checked";
      $output = $output . "<tr>";
      $output = $output . "<td><label for=\"$matches[1]\">$matches[1]</label></td>";
      $output = $output . "<td><input type=\"checkbox\" id=\"$matches[1]\" name=\"$matches[1]\" value=\"$matches[2]\" $checked></td>";
      $output = $output . "</tr>";
    }

    // text field
    else if ( preg_match('/^(\w+)_=(.*)$/', $line, $matches) )
    {
      $output = $output . "<tr>";
      $output = $output . "<td><label for=\"$matches[1]\">$matches[1]</label></td>";
      $output = $output . "<td><input type=\"text\" name=\"$matches[1]\" id=\"$matches[1]\" value=\"$matches[2]\" size=\"40\"></td>";
      $output = $output . "</tr>";
    }
  }

  $output = $output . "</table>";
  fclose($fh);

  echo json_encode( $output ) . ' }'; // close JSON
}

else if ( $_POST['action'] == "launch" && $_POST['config'] )
{
  if ( !$_POST['ref'] ) exit( '{ "output": "Invalid request" }' );

  // CSRF check
  $token = isset($_POST['csrf_token']) ? $_POST['csrf_token'] : '';
  if ( empty($token) || !validateCSRFToken($token) )
    exit( '{ "output": "Unauthorized request. Try reloading the page" }' );

  chdir('/usr/local/etc/nextcloudpi-config.d/');

  $file = $_POST['ref'] . '.sh';

  if ( $_POST['config'] != "{}" )
    $params = json_decode( $_POST['config'], true )
                or exit( '{ "output": "Invalid request" }' );

  $code = file_get_contents( $file )
            or exit( '{ "output": "' . $file . ' read error" }' );

  foreach( $params as $name => $value) 
  {
    preg_match( '/^[\w.,@_\/-]+$/' , $value , $matches )
      or exit( '{ "output": "Invalid input" , "token": "' . getCSRFToken() . '" }' );
    $code = preg_replace( '/\n' . $name . '_=.*' . PHP_EOL . '/'  ,
                        PHP_EOL . $name . '_=' . $value . PHP_EOL ,
                        $code )
              or exit();
  }

  file_put_contents($file, $code )
    or exit( '{ "output": "' . $file . ' write error" }' );

  // Get new token
  echo '{ "token": "' . getCSRFToken() . '",';
  echo ' "output": "" , ';
  echo ' "ret": ';

  exec( 'bash -c "sudo /home/www/ncp-launcher.sh ' . $file . '"' , $output , $ret );
  echo '"' . $ret . '" }';
}

else if ( $_POST['action'] == "poweroff" )
{
  // CSRF check
  $token = isset($_POST['csrf_token']) ? $_POST['csrf_token'] : '';
  if ( empty($token) || !validateCSRFToken($token) )
    exit( '{ "output": "Unauthorized request. Try reloading the page" }' );
  shell_exec( 'bash -c "( sleep 2 && sudo halt ) 2>/dev/null >/dev/null &"' );
}

// License
//
// This script is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This script is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this script; if not, write to the
// Free Software Foundation, Inc., 59 Temple Place, Suite 330,
// Boston, MA  02111-1307  USA
?>

Can you access ncp-web on port 4443? Did you move the database to your external USB drive?

Output of

systemctl status mysqld

That’s the most likely cause, if your drive goes to sleep it can crash the database. In that case, try moving it back to /var/lib/mysql

1 Like

Yes that is what I have done. I had problem to return it back to /var/lib/mysql because I have accepted the defaults of nc-database which was /media/USBdrive which I have never create. So after reboot the directory USBdrive was not exist so I created and I had to soft link it with

sudo ln -s /media/myCloudDrive/* /media/USBdrive/

Then I could run again the nc-database to /var/lib/mysql

Thank you