CentOs安装网站环境(五)目录权限设置

32次阅读

网站目录 www,web服务器以www用户运行,网站分配的用户为centos,网站目录 为/var/www/html

groupadd www //新建test工作组

useradd -g www centos //新建centos用户并增加到www工作组

1、首先设置网站目录所有者为centos,用户组为www,目录设置为750,文件为640。
cd /var/www
chown -R centos.www /var/www/html
find /var/www/html -type d -exec chmod 750 {} \;
find /var/www/html -not -type d -exec chmod 640 {} \;

chown -R centos.www /var/www/html
find /var/www/html -type d -exec chmod 777 {} \;
find /var/www/html -not -type d -exec chmod 777 {} \;

chown -R centos.www /var/www/html
find /var/www/html -type d -exec chmod 755 {} \;
find /var/www/html -type f -exec chmod 755 {} \;

chown -R centos.www /var/www/html/wp-content
find /var/www/html/wp-content -type d -exec chmod 777 {} \;
find /var/www/html/wp-content -type f -exec chmod 777 {} \;

网站根目录权限问题解决

chown -R www.www /data/wwwroot/
find /data/wwwroot/ -type d -exec chmod 755 {} \;
find /data/wwwroot/ -type f -exec chmod 644 {} \;

 

正文完
 0