0

I'm using localhost to develop some web pages (LAMP stack, Lubuntu desktop, trusty 14.04).

Each time I create a new folder inside /var/www/html, read privileges seem to be set to owner only by default. This is resulting in a blank white page when I go to localhost/folder-name in my browser.

How can I change things so that the default read privilege is anyone for my localhost projects? I'd like to avoid having to change folder permissions each time I create a new folder.

Flimzy
  • 381

1 Answers1

2

If it's just you creating the websites and no other user needs access to it you can just change the apache config to run the webserver as your user.

in the terminal change the permissions of /var/www/html to your user

sudo chown -R username:username /var/www/html

Then change your apache envvars

sudo nano /etc/apache2/envvars

And change the lines to your user.

export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data

Restart apache and everything should work correctly without having to mess around with folder permissions.

sudo service apache2 restart

Alternative

You can set the permissions using a crontab, just type crontab -e into the terminal and add this line to the bottom

* * * * * chmod -R 755 /var/www/