I'm trying to install Magento 2. I run this for permission file and folder

chown -R admin:www-data /var/www/magento2
find /var/www/magento2 -type f -print0 | xargs -r0 chmod 640
find /var/www/magento2 -type d -print0 | xargs -r0 chmod 750
chmod -R g+w /var/www/magento2/{pub,var}

I use default Magento2 .htaccess file (permission is 660, i tried other permission like 750) but still got this error


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

I tried to add this on .htaccess file but not work

<Directory /mymagento2-folder/>
  AllowOverride None

What should I check or try to see magento2 install page?

3 Answers 3


If using Apache 2.4, try similar virtual hosts config:

<VirtualHost *:80>
    DocumentRoot "/var/www/magento2ce"
    ServerName magento2.vagrant
    <Directory /var/www/magento2ce>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted

If Apache 2.2, then replace Require all granted with Allow from all. See more details in the official dev docs.

  • this is maybe a bad idea to grant access.
    – MagenX
    Dec 4, 2015 at 23:24
  • @MagenX what is better option? This one seems to be officially recommended. Dec 5, 2015 at 9:44

probably as you have set permissions 640, either admin or www-data is not in the game. you have to make sure that your apache web server is actually has some admin or www-data in its uid/gid

just to debug this issue set permissions 644/755

and is .htaccess available?


Please set default permission for Magento 2 root directory by running following command:

sudo find . -type d -exec chmod 770 {} \; && sudo find . -type f -exec chmod 660 {} \; && sudo chmod u+x bin/magento

I hope it works for you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.