Hi,

We have set up the folder & vhosts. But when I ma trying to acces the site it is giving the following error -

You don’t have permission to access this resource.Server unable to read htaccess file, denying access to be safe

Thanks

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
1 answer

Hello,

You would need to update the ownership of the files and folders of your new website so that the Apache service could access them.

The user that the Apache service runs with by default is www-data, if you’ve not changed it, you could use the chown command to change the owner of the files and folders of your new website:

chown -R www-data:www-data /var/www/your_website

If you are still getting the error after that, you could check the Apache error log:

tail -100 /var/log/apache2/error.log

Hope that this helps.
Regards,
Bobby

  • Still having the same issue after the changes.

    • Hi,

      Can you share the output of your error log and also your Apache Vhost config that you’ve created?

      Regards,
      Bobby

      • Error log -

        [Tue Jul 13 11:32:31.851230 2021] [core:crit] [pid 3628:tid 140235530606336] (13)Permission denied: [client 47.11.123.21:51665] AH00529: /sites/sourceen54.com/htdocs/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/sites/sourceen54.com/htdocs/' is executable
        [Tue Jul 13 11:32:32.396125 2021] [core:crit] [pid 3628:tid 140235438548736] (13)Permission denied: [client 47.11.123.21:51665] AH00529: /sites/sourceen54.com/htdocs/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/sites/sourceen54.com/htdocs/' is executable, referer: http://www.sourceen54.com/
        [Tue Jul 13 11:42:12.695720 2021] [core:crit] [pid 3627:tid 140235735848704] (13)Permission denied: [client 183.136.225.14:27165] AH00529: /sites/sourceen54.com/htdocs/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/sites/sourceen54.com/htdocs/' is executable
        [Tue Jul 13 11:42:13.351095 2021] [core:crit] [pid 3627:tid 140235777812224] (13)Permission denied: [client 183.136.225.14:13967] AH00529: /sites/sourceen54.com/htdocs/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/sites/sourceen54.com/htdocs/' is executable
        [Tue Jul 13 11:42:13.778539 2021] [core:crit] [pid 3627:tid 140235761026816] (13)Permission denied: [client 183.136.225.14:29071] AH00529: /sites/sourceen54.com/htdocs/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/sites/sourceen54.com/htdocs/' is executable
        

        Virtual host set up -

        <VirtualHost *:80>
          ServerName www.sourceen54.com
          DocumentRoot /sites/sourceen54.com/htdocs
          CustomLog /var/log/httpd/sourceen54.com/access_log "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\""
          ErrorLog /var/log/httpd/sourceen54.com/error_log
          <Directory "/sites/sourceen54.com/htdocs">
                  AllowOverride All
                  Require all granted
                  Options -Indexes
          </Directory>
        #  <Location />
        #    MaxConnPerIP 60
        #  </Location>
        </VirtualHost>
        
        <VirtualHost *:80>
          ServerName sourceen54.com
          ServerAlias www.sourceen54.eu sourceen54.eu
          Redirect 301 / https://www.sourceen54.com/
          CustomLog /var/log/httpd/sourceen54.com/access_log "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\""
          LogLevel emerg
        </VirtualHost>
        
        edited by MattIPv4
        • Hi,

          I could suggest a couple of things:

          • Add the following to your virtual host:
          <FileMatch "^\.ht">
            Order allow,dey
            Allow from all
          </FileMatch>
          

          And then restart the Apache service

          • If you have SELinux enabled run the following two commands:
          setsebool -P httpd_enable_homedirs true
          chcon -R -t httpd_sys_content_t /sites/sourceen54.com/htdocs
          

          Hope that this helps.
          Regards,
          Bobby