# Allow lighttpd to read anything in htdocs, applications, conf and data
sudo setfacl -R -m d:u:$HTTPD_USER:rX,u:$HTTPD_USER:rX "$DIR/htdocs" "$DIR/applications" "$DIR/conf" "$DIR/data"
-# Allow lighttpd to write new files in logs (but not touch existing or those created by lighttpd)
-sudo setfacl -m u:$HTTPD_USER:rwX "$DIR/logs"
+# Allow lighttpd to write new files in logs
+sudo setfacl -m d:u:$HTTPD_USER:rwX,u:$HTTPD_USER:rwX "$DIR/logs"
# Give scripts read access to the dir itself
sudo setfacl -m u:$SCRIPT_USER:rx "$DIR"
# Temp, chown existing log files
sudo sh -c "chown -R $SCRIPT_USER \"$DIR\"/logs/php.log* \"$DIR\"/logs/wipi.log*"
-sudo sh -c "chown -R $HTTPD_USER \"$DIR\"/logs/access.log*"
+sudo sh -c "chown -R $HTTPD_USER \"$DIR\"/logs/access.log* \"$DIR\"/logs/*/access.log*"
# Now, set the error_log setting in php.ini. This ensures each domein will have
# a separate logfile for errors, since lighttpd only supports a single error