magento 2 setup on existing vagrant environment using browser

Posted by Damodar Bashyal on December 23, 2015


Step 1: Download and extract magento 2 enterprise edition on your project folder

Installing magento steps

Step 2: Open your local /etc/hosts file and point to your environment IP as:

Step 3: Update your Homestead.yaml file to setup magento 2 as below

    - map:
      to: /home/vagrant/Projects/mageee2

    - mageee2

Step 4: go to your project with vagrant file in it and run:

vagrant provision

Step 5: update your ngnix config for magento 2, which was created as a result of vagrant provision

sudo nano /etc/nginx/sites-available/

and update like this:

upstream fastcgi_backend {
   # use tcp connection
   # server;
   # or socket
   server   unix:/var/run/php5-fpm.sock;

server {
    listen 80;
    listen 443 ssl;

    set $MAGE_ROOT /home/vagrant/Projects/mageee2;
    set $MAGE_MODE developer;
    include /home/vagrant/Projects/mageee2/nginx.conf.sample;

    ssl_certificate     /etc/nginx/ssl/;
    ssl_certificate_key /etc/nginx/ssl/;

Step 6: restart nginx to apply new config changes.

sudo service nginx restart

Step 7: Now visit setup url on your browser:

Step 8: setup error fix If you receive error: Access to the script setup/index.php/navigation has been denied

Open magento 2’s nginx.conf.sample and add this line if it doesn’t exist (after: location ~ ^/setup/index.php {):

try_files $uri $uri/ /setup/index.php?$query_string;

so it looks like this:

location /setup {
    root $MAGE_ROOT;
    location ~ ^/setup/index.php {
        try_files $uri $uri/ /setup/index.php?$query_string;
        fastcgi_pass   fastcgi_backend;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;

    location ~ ^/setup/(?!pub/). {
        deny all;

    location ~ ^/setup/pub/ {
        add_header X-Frame-Options "SAMEORIGIN";

Then, restart your nginx again. You should be able to proceed with magento 2 setup now.

Other errors I encountered during setup.

1. 2 missing PHP extensions. (xsl and intl) => ran these commands

sudo apt-get update
sudo apt-get install php5-intl
sudo apt-get install php5-xsl

PHP settings check failed with this message: Your PHP Version is, but always_populate_raw_post_data = 0. $HTTP_RAW_POST_DATA is deprecated from PHP 5.6 onwards and will be removed in PHP 7.0. This will stop the installer from running. Please open your php.ini file and set always_populate_raw_post_data to -1. If you need more help please call your hosting provider. =>

sudo nano /etc/php5/fpm/php.ini
# and uncomment line:
always_populate_raw_post_data = -1

Installation got stuck at 90%, so to restart process again followed this steps:

# php.ini increased timeout: 
max_execution_time = 18000

removed app/etc/env.php

removed maintenance flag to disable maintenance mode: var/.maintenance.flag

After restarting setup, checked/selected to “cleanup database automatically”.

Installing magento steps

I didn’t encounter any other issues and successfully installed magento 2 enterprise on my vagrant box.

ekko92 posted on - Thursday 18th of February 2016 11:24:35 PM

I did go to step 4 and k can continue. Please help me

Web Developer posted on - Saturday 28th of May 2016 07:10:09 AM

Thanks for the share. i needed this the most.

ming posted on - Wednesday 23rd of December 2015 06:09:37 AM

This is very cool.
not published on website

QR Code: magento 2 setup on existing vagrant environment using browser