One of the (many) great things about using the open source CMS Grav for a flipped-LMS approach is that no database is required, which makes running a local copy of Grav on your computer for testing purposes a very straightforward process. This also makes deployment to a Web server a breeze - just a simple folder copy.
In this brief article we will look at how to use MAMP, a tool to safely run a PHP server on your computer, to view Grav sites locally on your Mac or Windows PC.
If you do not have an existing Grav site on your computer, download a Grav Skeleton at (https://getgrav.org/downloads/skeletons) and extract the downloaded archive file
Create a folder called ‘MAMP Websites’ in your ‘Documents’ folder
Copy the entire Grav folder into your ‘MAMP Websites’ folder
Launch MAMP (but do not press the ‘Start Servers’ button yet)
Press the MAMP ‘Preferences’ button
Figure 1. MAMP startup screen where the ‘Preferences’ button is located.
Press the ‘Web Server’ tab in the ‘Preferences’ dialog
Figure 2. MAMP preferences dialog, with the ‘Web Server’ tab on the far top-right.
Change the ‘Document Root’ MAMP preferences setting from the default value ‘htdocs’ within the MAMP application folder to the ‘MAMP Websites’ folder that you previously created within ‘Documents’ by pressing the select folder button (a folder containing three dots), choosing the folder, and then pressing the ‘OK’ button
Figure 3. MAMP Web server tab, with the select folder button represented by a folder containing three dots.
- Press the MAMP ‘Start Servers’ button (as shown in Figure 1)
With MAMP installed and running you can now view your Grav site(s) locally. Launch your Web Browser, enter the URL http://localhost:8888 and then choose the displayed Grav folder name. That’s it! If you downloaded a Grav Skeleton with the Admin Panel pre-installed you will be prompted to create your administrator account.
Additional MAMP Setup Options
If you would prefer, you only need to enter ‘http://localhost’ in your Web Browser to access your MAMP htdocs directory listing, then do the following:
Launch the MAMP application - if MAMP is already running, press the ‘Stop Servers’ button
Press the MAMP ‘Preferences’ button (see Figure 1)
Press the ‘Ports’ tab in the ‘Preferences’ dialog
Figure 4. MAMP ports panel tab.
Change the value in the ‘Appache Port’ field from the default value ‘8888’ to ‘80’ (no quotes)
- Press the ‘OK’ button
If you are curious about how a local copy of Grav can be used with GitHub/GitHub Desktop for super-easy deployments while fully supporting student collaboration, check out the article Using Grav with GitHub Desktop (and Deploy).
Looking to help educators at your organization leverage the capabilities of Grav? I offer consulting, workshops, premium support and custom development - let's connect!