title: Laravel: mkdir(): Permission denied - Nginx
body: <p>Trying to upload a file with opening new folder.
  But laravel returns error like below.</p>
  <pre><code>    $destinationPath = public_path() . $folderName;
      if(!is_dir(public_path().'/uploads')) {
        mkdir(public_path().'/uploads', 0755, true);
      }
      $mkdir = mkdir(public_path().'/uploads/'.$unique, 0755, true);
      $success = file_put_contents(public_path().'/uploads/'.$unique.&quot;/&quot;.$filename, $file);
  </code></pre>
  <p>I used;</p>
  <pre><code>sudo chown -R nginx:nginx public/uploads
  sudo chown -R root:root public/uploads
  sudo chown -R $USER:$USER public/uploads
  </code></pre>
  <p>But nothing changed.
  What's wrong?</p>
  <p>Is laravel's nginx user different? How can I learn?</p>