cancel
Showing results for 
Search instead for 
Did you mean: 

.htaccess blocking lots of files after install

.htaccess blocking lots of files after install

I have installed Magento, all folder permissions and ownership are properly set.

 

I have had my hosting company look at all this and they are certain everything is set right.

 

But I am still getting this error when visiting the url:

 

You don't have permission to access / on this server.
Server unable to read htaccess file, denying access to be safe

My hosts then noticed that a lot of important files are being blocked by .htaccess file, as per below:

 

###########################################
## Deny access to root files to hide sensitive application information
    RedirectMatch 404 /\.git

    <Files composer.json>
        order allow,deny
        deny from all
    </Files>
    <Files composer.lock>
        order allow,deny
        deny from all
    </Files>
    <Files .gitignore>
        order allow,deny
        deny from all
    </Files>
    <Files .htacces>
        order allow,deny
        deny from all
    </Files>
    <Files .htaccess.sample>
        order allow,deny
        deny from all
    </Files>
    <Files .php_cs>
        order allow,deny
        deny from all
    </Files>
    <Files .travis.yml>
        order allow,deny
        deny from all
    </Files>
    <Files CHANGELOG.md>
        order allow,deny
        deny from all
    </Files>
    <Files CONTRIBUTING.md>
        order allow,deny
        deny from all
    </Files>
    <Files CONTRIBUTOR_LICENSE_AGREEMENT.html>
        order allow,deny
        deny from all
    </Files>
    <Files COPYING.txt>
        order allow,deny
        deny from all
    </Files>
    <Files Gruntfile.js>
        order allow,deny
        deny from all
    </Files>
    <Files LICENSE.txt>
        order allow,deny
        deny from all
    </Files>
    <Files LICENSE_AFL.txt>
        order allow,deny
        deny from all
    </Files>
    <Files nginx.conf.sample>
        order allow,deny
        deny from all
    </Files>
    <Files package.json>
        order allow,deny
        deny from all
    </Files>
    <Files php.ini.sample>
        order allow,deny
        deny from all
    </Files>
    <Files README.md>
        order allow,deny
        deny from all
    </Files>

 

Can anyone explain what the hell? It doesnt mention anything about this in the install documentation.

 

I've found the Magento install an absolute nightmare. I've been trying to get this installed for weeks?!?!

4 REPLIES 4

Re: .htaccess blocking lots of files after install

you have incorrect permissions set. files must be owned by php/apache user, and readable. folders too

------------
MagenX - Magento and Server optimization

Re: .htaccess blocking lots of files after install

er... perms are fine, folders 770. FIles 660.

 

File ownerships are correct. As stated above

 

Next?

Re: .htaccess blocking lots of files after install

I have to be honest.

 

What an absolute and utter load of rubbish the documentation and support is for this product, I'm an experienced developer for over 10 years, and along with my reputable and knowledgeable hosting company we have been unable to get the installation working, this is a joke!

 

I've been trying this for weeks.

 

I've read and gone over bit by bit every bit of documentation and tutorial that I could find in the entire googlesphere.

 

And I'm sat here like a 1st grade idiot with absolutely no idea how to get this working.

 

 

 

 

Re: .htaccess blocking lots of files after install

I have been encountering a lot of issues with M2 too, which just feel like it's massively untested. But file permissions haven't been one of them!

 

I have re-installed M2 about 8 times (various VM instances, experimenting) and permissions are usually fine.

 

I create a Magento user as 'magento' and have it belong to the 'apache' group.

e.g.:

[root@vm-h002474-m2ee2 eeshop.mydomain.co.uk]# id magento
uid=500(magento) gid=48(apache) groups=48(apache)

 

Then from my root web (M2) folder, run:

find ./ -type d -exec chmod 770 {} \; && find ./ -type f -exec chmod 660 {} \; && chown -R apache:apache ./*; chmod u+x bin/magento

 

From here on, I rarely get issues with permissions.