- Configure Apache for Virtual Hosting The default MAMP Apache install does not offer pre.
- Bitnami MAMP Stack provides a complete, fully-integrated and ready to run MAMP development environment. In addition to PHP, MySQL and Apache, it includes FastCGI.
MAMP is the most popular local web development solution for Mac OSX. Sep 12, 2017 Magento 2 Install Magento 2 locally on MAMP. This is a short step by step tutorial about how to install Magento 2 locally on MAMP. We will see how to install MAMP and how to configure the proper PHP and MySQL versions.We’ll then connect to Github and get Magento 2 sources and install it via Composer. Magento 2.0 no longer needs all kinds of gyrations to install locally anymore. However the MySQL has been included in Mamp Pro 4x or later versions. So now it is much easier to install Mage locally in your Mac using Mamp. As of now Mamp comes with fully functional MySQL version for Mage.
When developing and testing a production Magento store locally it’s easy and convenient to set up an exact replica of the production environment. This can be achieved using Apache virtual hosting and your operating system hosts file.
This post will walk you through setting up a local testing Magento install for MAMP Leopard to include a virtual hosting configuration and how to configure your operating system to send requests for your production site to your local testing environment.
This post will not cover installing Magento, copying an existing production Magento – it is assumed this will have already been done and we are focusing only on how to actually set up an Apache virtual host and the operating system hosts file. If you need help installing MAMP you can read my step by step guide to install MAMP on Leopard.
Step 1: Configure Apache for Virtual Hosting
The default MAMP Apache install does not offer pre-configured virtual hosting but it can be easily added. First thing to do is back up your existing MAMP Apache configuration files.
Now you need to edit the
httpd.conf
file to add virtual hosting configuration. Open the file with your favourite text editor and add the following to the end:This tells Apache to include another file called
sites
which we obviously haven’t created yet.We could include our virtual hosting configration in the httpd.conf file but it’ll get grubby if we start having many local sites. Likewise we could include an entire directory (say one called ‘sites-enabled’) and then have a symlink for each site within that directory pointing to a file in a directory called site-available! If you want to set up something more robust like that, you can. Before you do though, ask yourself how many production stores you’ll be running from your laptop…
Anyway back to the actual configuration. Now we create a file called
sites
in the directory we told Apache it was (recall that was: /Applications/MAMP/conf/apache/)And put the following configuration into the file:
Your DocumentRoot value should match up to where you have installed Magento. It helps your organization to have an entire directory dedicated to different virtual host Document Roots and to name each Document Root after the site it is the root of as in my example configuration.
You can add as many VirtualHost sections as you like in this sites file. Each one will be a new testing or development site.
After saving the
sites
file you can restart MAMP and it should now support virtual hosting and have one virtual host running. If you open a browser and browse to example.com though, you will still see the production site.This is because your local computer is still requesting DNS records for the domain name and it is still resolving the real IP address. Never fear though, we can instruct our local computer not to get the DNS record, by giving it a local name resolution through the hosts file.
Step 2: Setup your hosts file
I won’t tell you about a hosts file here, someone has already written up an excellent description of the hosts file, I’ll just explain how to add configuration for your local Apache testing virtual host. Sid meiers civilization for mac download.
Before going any further I’ll stress that if you set up a name exactly the same as your production server then you will end up confusing your production and testing sites at least once. If you want to avoid this and create a really clean separation then make the test environment a virtual subdomain such as test.example.com.
Syriac font for mac. To proceed with the same name setup, then simple edit your /etc/hosts file as root.
and find the line for 127.0.0.1 then edit it to look like this:
You can add more and more sites too like:
Note that all the entries need to be on one line, i.e. no line breaks.
Now when you visit example.com in your browser you will be able to see your local testing Magento installation running as a virtual host on MAMP Apache. if you can’t for some reason, let me know and I’ll help you with it.
To revert back to using DNS entries you just remove the site from the line and refresh in your browser.
Mamp Magento 2
You might also be interested in: