You don't have permission to upload or create files here right after the installation on a websever

Hello, I just installed nextcloud on my web server, but right after I login with my newly created admin account, there is this line under the top bar, telling me that I can’t upload files. I can’t even open the “welcome files”.
I used both SQLlite and MySQL, and none of them worked…

EDIT: On the mobile application, when I go on the files and favorites tab, I get a 501 HTTP error.

Check your data dir in config/config.php.

Set the correct rights.

chown www-data:www-data /path/to/datadir

For further help post your config/config.php .

Here is my config.php, (I removed sensitive data):

$CONFIG = array (
  'instanceid' => 'oc74y4qzi2o1',
  'passwordsalt' => '-',
  'secret' => '-',
  'trusted_domains' => 
  array (
    0 => '-',
  'datadirectory' => '/home/[username]/subdomains/cloud/data',
  'dbtype' => 'sqlite3',
  'version' => '',
  'overwrite.cli.url' => '-',
  'installed' => true,

Following your answer, i tried this command, but the user www-data doesn’t exist, and I don’t know what to replace it with…

So I finally found the solution. I had to disable the ModSecurity feature on my subdomain.