I was setting up a new Magento 2 installation for a project. It’s the first time I’ve done it from scratch for a long time.
I setup the code, vhost, host file rewrite to my local vm, etc. Went to http://mydomain.local/ and got redirected to http://mydomain.local/setup with a message saying “Too many redirects.”
It turns out that if you setup your vhost the right way and point to {magento-root}/pub the web installer doesn’t work.
The fix was to point the vhost to {magento-root}, run the web installer then change the vhost root back to {magento-root}/pub.
In apache it looked like this for the install:
<VirtualHost *:80>
ServerName mysite.local
DocumentRoot /var/www/mysite/httpdocs
<Directory "/var/www/mysite/httpdocs">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Allow from all
Require all granted
</Directory>
</VirtualHost>
Then I changed it back to this for the development of the site:
<VirtualHost *:80>
ServerName mysite.local
DocumentRoot /var/www/mysite/httpdocs/pub
<Directory "/var/www/mysite/httpdocs/pub">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Allow from all
Require all granted
</Directory>
</VirtualHost>
Obviously the production site will have a lot more apache directives in it, or better yet, use Nginx and php-fpm with SSL directives, etc. But for development on a local Apache server, this works great.