SELinux 导致文件不能写入

可以使用下面的命令来修正文件不能写入的错误:

[code]# Ownership
sudo chown apache:apache -R /data/www/html/sites/mysite
cd /data/www/html/sites/mysite

File permissions, recursive

find . -type f -exec chmod 0644 {} ;

Dir permissions, recursive

find . -type d -exec chmod 0755 {} ;

SELinux serve files off Apache, resursive

sudo chcon -t httpd_sys_content_t /data/www/html/sites/mysite -R

Allow write only to specific dirs

sudo chcon -t httpd_sys_rw_content_t /data/www/html/sites/mysite/logs -R
sudo chcon -t httpd_sys_rw_content_t /data/www/html/sites/mysite/uploads -R[/code]