Please make sure that “/” is writable by the web-server. [Magento 2.4 Sitemap]

okay Mr. Craig, I found the solution by tests and I am still wondering if this is the correct way to solve it. Please reply me to let general know about it. @digitalstartup

My Solution:

Step 0. (Optional)

Change back the owner of /var/www/html to the www-data

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

This Step 0 is optional because I can’t make Step 1 successfully when the owner of /var/www/html is user “magento2” which is not superuser.


Step 1.
Run command

sudo chmod -R 775 /var/www/html

as the “superuser” from within any directory first, -R is missing at the below link, I think it’s quite important in this case:

The documents’ name turn Green if they changed into 775!
螢幕快照 2022-05-03 上午1.23.54


Step 2.
Final Step, do remember to change the owner of /var/www/html back to “magento2” by command

sudo chown magento2:www-data /var/www/html

Notice (magento2 = username of Magento databases’ owner which I chose at the beginning we set up our Magento), it equals to character of user “magento” in Ubuntu Server at How to install Magento 2.4.5-p1 and build a web server (updated)
12314


Result:

We did it!