3

This first post of mine here at the EESE could perhaps be regarded as a Mamp-problem rather than an EE-thing. But I would very much like to hear from the EE-community on this since replies here probably are a lot more likely to be of use to me then replies elsewhere.

The EE-docs suggest moving the systemfolder above web root for security reasons. The documentation illustrates this:

Image 1

So I guess in Mamp Pro it would look like this:

Image 2

What I am trying to figure out is how do I keep multiple local EE-projects in my htdocs-folder, all with their 'elevated' system-folders above root and still manage to commit and push one project at the time AND the loose system-folder of that project?

Thanks! /David


Ooops! Not allowed...

Images I am not allowed to post to illustrate my problem:

Tags I meant to apply but was forbidden to:

  • mamp
  • systemfolder
  • webroot
  • beanstalk
  • versioncontrol
  • I added images and links. Either you don't have an account and have limited privileges or your using another systems formatting. Just use the image and link buttons, until your familiar with the format style. – nonprofit_tech Jan 15 '13 at 0:37
  • Thanks. for helping me out on this. Yes, this was my first post and I had no reputation for ammo at all. At first I got a little frustrated but soon realized the reputation increases at a greater pace than I first feared. I'm starting to like this stackexchange thing more and more! :) – David S Jan 16 '13 at 0:43
  • No problem. Glad you found an answer. – nonprofit_tech Jan 16 '13 at 14:41
8

I do this exact thing on my local machine and I have over 30 sites setup with it - so dont worry it is perfectly doable! I have a MAMP Pro setup using Git & Beanstalk to handle VCS, code hosting and deployment.

In order to have the system folder above root, here is an example project folder structure that would work with the system folder moved above root:

site-1/
|--www/
|   |--images/
|   |--themes/
|   |--uploads/
|   |--index.php
|   |--admin.php
|--system/
|   |--codeigniter/
|   |--expressionengine/
|   |--index.html
|   |--index.php

Note: I have used www as a folder name for the root site folder, but you should use whatever your hosting provider uses. This could be www, public_html, htdocs etc.

So all has happened here is that the system has been moved upwards one level. Of course in order to do this you need to update the system path in index.php as per the EE Docs:

$system_path = '../system';

The in MAMP Pro create a new host for this site (Server name "site-1" and set the "disk location" to the site-1/www/ folder. If you are unsure about this, you can check out this example video or have a look at the MAMP Pro docs.

With the site up and running locally you can then commit the site to a git repository. I tend to alway use the site-1/ folder as the root of the git repository. That way it holds the system folder as well as the www folder.

Once it is in Git you can send your repo to Beanstalk and have Beanstalk deploy it for you. The trick here is to get beanstalk to deploy your files one folder higher than normal so that when it writes the files in the www/ folder, they end up below your site root and can be viewed.

Once setup, you have the ease of use MAMP Pro along with the benefits of using Git & Beanstalk for deployments. You can then start adding multiple projects to your local htdocs folder and creating a new MAMP Host for each site. You'll end up with a collection of your projects all sat neatly beside each other:

site-1/
 |--www/
 |--system/
site-2/
 |--www/
 |--system/
site-3/
 |--www/
 |--system/
| improve this answer | |
  • In case it's not obvious, this technique is only (easily) doable in MAMP Pro. The free version requires manually adding virtual hosts to the appropriate files. – Jason Varga Jan 15 '13 at 14:30
  • Thanks Christopher! This is roughly how I imagined it but you really helped me forward with this. But I am not there yet. The deployment is still a fuzzy part for me, simply because I have not yet had an oportunity to try it out. And this because all sites I have been experimenting on are testsites that are all to sit in subdomains. So here is my followup question: ## How do I deploy sites in subdomains? This part worries me a bit sins I have quite some subdomains on my 'proving grounds'. – David S Jan 16 '13 at 0:39
  • @DavidS the method of deploying to subdomains is different for each host, but they all typically will have a web root folder. You will need to find out the method used by your host and then update the folder structure accordingly (eg: the 'www' might be named differently. – Christopher Imrie Jan 22 '13 at 9:30

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.