Permission denied: /var/www/abc/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable?

后端 未结 4 633
滥情空心
滥情空心 2020-12-04 14:37

Hi all I\'m using PHP for my website and ubuntu linux on my system. I got the above error in error.log file of apache, even after configurating everything properly. I did a

4条回答
  •  無奈伤痛
    2020-12-04 14:59

    If it gets into the selinux arena you've got a much more complicated issue. It's not a good idea to remove the selinux protection but to embrace it and use the tools that were designed to manage it.

    If you are serving content out of /var/www/abc, you can verify the selinux permissions with a Z appended to the normal ls -l command. i.e. ls -laZ will give the selinux context.

    To add a directory to be served by selinux you can use the semanage command like this. This will change the label on /var/www/abc to httpd_sys_content_t

    semanage fcontext -a -t httpd_sys_content_t /var/www/abc
    

    this will update the label for /var/www/abc

    restorecon /var/www/abc 
    

    This answer was taken from unixmen and modified to fit this question. I had been searching for this answer for a while and finally found it so felt like I needed to share somewhere. Hope it helps someone.

提交回复
热议问题