Search code examples
laravelnginxfilesystemslaravel-5.5

folder created has the user and group as www-data - Laravel


I am trying to create a folder in the app directory but for whatever reason the there is a lock symbol in the folder icon and the user and it's group is www-data.

$folder_path = app_path('core/'.$module);
if (!file_exists($folder_path)) {
    File::makeDirectory($folder_path, $mode = 0755, $recursive = false, $force = false);
    //mkdir($folder_path, 0777);

    exit;
} else {
    //
}

When I was trying to create the folder there was a permission denied error so I did chmod -R 777 app/core/ after this when I try to create the user associated to it is www-data.

Why is it www-data and not my username and why is there a lock symbol?

NOTE: Using nginx web server.


Solution

  • As default, nginx and php-fpm will run as user www-data. You can check in your /etc/nginx/nginx.conf and /etc/php/{version}/fpm/pool.d/www.conf

    See here if you want to config your web app run as your username.