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

后端 未结 4 622
滥情空心
滥情空心 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:45

    I had the same issue when I changed the home directory of one use. In my case it was because of selinux. I used the below to fix the issue:

    selinuxenabled 0
    setenforce 0
    
    0 讨论(0)
  • 2020-12-04 14:55

    I have also got stuck into this and believe me disabling SELinux is not a good idea.

    Please just use below and you are good,

    sudo restorecon -R /var/www/mysite
    

    Enjoy..

    0 讨论(0)
  • 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.

    0 讨论(0)
  • 2020-12-04 15:04

    Make sure that the htaccess file is readable by apache:

    chmod 644 /var/www/abc/.htaccess 
    

    And make sure the directory it's in is readable and executable:

    chmod 755 /var/www/abc/
    
    0 讨论(0)
提交回复
热议问题