Should there be a nextcloud/data? 503 error about nextcloud.log

I’m trying to install fresh. I’ve confirmed that PHP is working (phpinfo() ; ) and I’m using nginx with the scrip in the manual adjusted to be not SSL (for the time being).

When I visit the IP address of the server I get a 503 error and when I look at my nginx logs it says:

2017/10/01 19:57:54 [error] 95218#100779: *1 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught ErrorException: fopen(/usr/local/www/nextcloud/data/nextcloud.log): failed to open stream: No such file or directory in /usr/local/www/nextcloud/lib/private/Session/Internal.php:150
Stack trace:
#0 [internal function]: OC\Session\Internal->trapError(2, 'fopen(/usr/loca...', '/usr/local/www/...', 132, Array)
#1 /usr/local/www/nextcloud/lib/private/Log/File.php(132): fopen('/usr/local/www/...', 'a')
#2 [internal function]: OC\Log\File::write('PHP', 'ErrorException:...', 3)
#3 /usr/local/www/nextcloud/lib/private/Log.php(307): call_user_func(Array, 'PHP', 'ErrorException:...', 3)
#4 /usr/local/www/nextcloud/lib/private/Log.php(165): OC\Log->log(3, 'ErrorException:...', Array)
#5 /usr/local/www/nextcloud/lib/private/Log/ErrorHandler.php(81): OC\Log->critical('ErrorException:...', Array)
#6 [internal function]: OC\Log\ErrorHandler::onException(Object(ErrorException))
#7 {main}
  thrown in /usr/local/www/nextcloud/lib/private/Session/Internal.php on line 150

It looks like the cause of the error is that nextcloud is attempting to write to a log file that it can’t access. I’ve looked in the root directory, there’s no data folder. Should there be? If so why isn’t it there? Do I create it, or did my unzipping fail somehow? I’ve tried with both the unix (tar.bz2) and windows (zip) distributions. Neither contain a data folder and both throw the same error.

The data directory and log file should be created automatically. Did you change owner of whole nextcloud directory to http user chown -R www-data:www-data /usr/local/www/nextcloud/ ? In case manually create data and requested log file and set owner to it, but should not be necessary.

What does automatically mean? It should be included in the download or there’s a script that needs to run?

It’s not in the download. Is there a listing of everything that should be included? I don’t really want to spend the next days manually creating files which were missing.

Data directory is not included within the downloaded archive. It should be created with first access/web installation of nextcloud, where you by the way also will choose the actual location of the data directory.

If somehow data cannot be created, it might be related to wrong permissions. Thus try to adjust them by chown -R www-data:www-data /path/to/nextcloud/.

Ah. Well I’ve done the chown. My users are www not www-data.