My server is from Alibaba Cloud. The default website directory is the newly created www directory. In this directory, the user and group are root, and the permissions are 755. At this time, when running php, writing operations cannot be performed in the directory. It has to be 777. Personally, I have set the user of the directory that needs to be written to www
, and the group is still root
, so that the writing operation can be performed. The users and groups to which nginx
and php-fpm
belong are both www
. Do you have any good suggestions for permission settings for directory groups?
It is recommended to set the www directory to www:www and then set the permissions to 755
Writing to a directory originally requires 7, so 777 is no problem. You wouldn’t set all directories to 777, but only set the directories that require write permission to 777.
@Samuelren
It is recommended that the www directory be set to www:www and then the permissions be set to 755
. This is obviously not possible, because it is equivalent to 7 for the entire directory.