Lost in permissions, blank page, Apache2 - local installation

I’m using Debian 12, and trying to run Grav under my home/user directory, with the right permissions

This is what I did so far :

  • in the /etc/apache2/envvars file, i’ve set the running user and group to “myuser:myuser” as follows :
export APACHE_RUN_USER=myuser
export APACHE_RUN_GROUP=myuser
  • i’ve changed ownership of /var/www/html to “myuser:myuser” (not sure wether this is right or not)
  • I’ve set a symbolic link in /var/www/html that points to /home/myuser/www/mywebsite
  • in the browser, my index.html file is showing as it should when browsing to localhost/mywebsite and so does the index.php I’ve set up

But when I try to access localhost/mywebsite/grav, then I get a blank page, unless I set permissions to 777 to the entire grav folder.

First question : is it wrong to change the /var/www ownership to myuser ?
Second question : did I do well when changing the envvars file as I did ? Is that the way for apache to run under my username ?
Third question : which permissions should I give to /mywebsite/grav ? should I change something ? If I let the permissions set to 777, will there be a security problem when transferring to my webhosting ?

Thank you very much in advance. I’m trying to understand all those ownership and permissions subtleties but it’s not that simple

I answered my third question this way:
I changed the ownership and permissions of home/user/www/mywebsite/grav this way :

cd
sudo chown -R www-data:myuser /www/mywebsite
sudo chmod -R 755
cd www/mywebsite
find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;

I know this is partially in the Grav documentation, but it is not much detailed for someone like me who didnt’ really understand what it is all about.

For example, the documentation doesn’t say we must be in the www/mywebsite folder before correcting the chmod. It seems pretty obvious now that I understand what I do with this command, but it wan’t at all when I first copy-pasted it in my terminal, and I guess I changed ownership of my entire home folder without even knowing.

My 2 other questions remain though. I want to be sure I did everything right.

1 Like