Magento – Install issue permission and htaccess

.htaccessmagento2permissionsserver-setup

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

Forbidden

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
</Directory>

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

Best Answer

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
    </Directory>
</VirtualHost>

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