0

I just launched a LAMP dropplet from Digital Ocean and am starting coding. When trying to create a new directory inside the web root it says

mkdir: cannot create directory ‘blog’: Permission denied

I can fix this by running chown -R user /var/www/html but I'm wondering if this will break things or if there's a better way of doing this. Thanks!

Egrodo
  • 350
  • 1
  • 5
  • 15

1 Answers1

1

You have a variety of options on permissions, but essentially www-data needs read (and probably execute) permission.

I like to redefine the DocumentRoot in my VirtualHost definitions to use something other than /var/www/html, anyway.

For example, you could use /srv/www/sitename, and then assign permissions myuser:www-data to it.

There are also numerous threads on the DigitalOcean forums (and around the internet) about permissions schemes for web files. (e.g. Proper Permissions for Web Server Directory.)

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Jameson
  • 6,400
  • 6
  • 32
  • 53
  • Perfect, thanks for the answer. I'll definitely change the document root and read through that forum page. – Egrodo Aug 22 '16 at 00:35