I have setup the enviroment for Magento 2 development in clean Ubuntu 14.04 image. Installed Magento with no troubles, but I'm thinking if there is any way to configure Vagrant to improve page load speeds during development.

in my Vagrantfile, I've setup the synced_folders to my "global" coding directory. This way ALL magento files are synced via NFS.

config.vm.synced_folder "~/Code/", "/var/www", type: "nfs"

Should I sync only app\code folder?


Find your two .htaccess files located at: .htaccess pub/.htaccess

Go to the lines that contain php_value memory_limit 256M and increase them. In each of the htaccess files, this line exists twice, so that means you need to change a total of 4 lines.

I increased mine to 1024M and it made a huge difference. Of course, you will also want to check the memory_limit value in php.ini as well. Most likely, that file is located at /etc/php/7.0/apache2/php.ini but you can run this command in your terminal to find the correct one. sudo find / -name 'php.ini'. Adjust the php.ini value if necessary and then reload with sudo service apache2 reload

|improve this answer|||||
  • Nice, so I would not need to sync only the folder that i am working on? app\code? If I change these parameters I can keep syncing the whole magento project? Thanks! – Bruno Rodrigues Sep 29 '16 at 16:47
  • I am running multiple M2 sites on one vagrant box, all are synched. no problems – Shawn Abramson Sep 29 '16 at 16:53
  • i should mention that it was VERY slow for me at first until i decided to track down the memory limits and adjust. Part of it also depends on the processor/memory on your physical machine as well – Shawn Abramson Sep 29 '16 at 16:54
  • I work with a Macbook Pro late 2012 - i5 - 8GB – Bruno Rodrigues Sep 29 '16 at 16:55
  • cool, that should be good. im on macbook pro 2014, so you should be good to go – Shawn Abramson Sep 29 '16 at 16:56

I made this vagrant which allow you to customize mount options:

  • nfs mount or regular mount
  • directory mount /var/www/magento/app or whole project /var/www/magento

You can work on a fast magento installation and adapt parameters depending on your work practice and your host machine perf.


|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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