I am setting up a configuration website on my RPi4 where I will host a web application through which the user can set up the system I am developing.
So far I have just worked on the code in a dir inside /home/pi and symlinked into /var/www/html/cgi-bin and seemingly it works.
My web app can send back webpages depending on posted data just fine.
But I also need to access some files (sqlite database for example) which needs write permissions so I started googling for info on this.
Now I am all confused, because on most webpages I have found they talk about the webpages and dirs as having www-data as both owner and group.
But on the default setup I have on my RPi4 it is just root:root.
Does Apache2 run as root in Raspbian rather than as www-data?
The display of my webpages work OK but as soon as my web app needs to access the sqlite database file I get a website error displayed.
So how can I let the web app executed by Apache2 access the sqilite database located outside of /var/www and also how can I let my web apps log their activity to a log dir also outside of /var/www?
If I run the web app manually as user pi from inside the development area it can access the sqlite database file just fine and also log to the log dir I have created.
PS: Running on RPi4B 4GB RAM with a fully updated Raspbian Buster DS