<p>I also use MAMP. Here's my general process (I've used generic names in this example; but feel free to rename folders, hosts, as needed):</p>

<ol>
<li><p>create the folders for your two sites:</p>

<p>/Applications/MAMP/htdocs/domain.craft.dev
 /Applications/MAMP/htdocs/subdomain.domain.craft.dev</p></li>
<li><p>Download craft, unzip and copy the <code>public</code> and <code>craft</code> folders to your new folders:</p>

<p>/Applications/MAMP/htdocs/domain.craft.dev/craft
 /Applications/MAMP/htdocs/domain.craft.dev/public
 /Applications/MAMP/htdocs/subdomain.domain.craft.dev/craft
 /Applications/MAMP/htdocs/subdomain.domain.craft.dev/public</p></li>
<li><p>Create two new hosts in MAMP, 'domain.craft.dev' and 'subdomain.domain.craft.dev'; set the 'document root' to the respective '/public' folders; start server. (I also have the server set to serve on port 80 instead of the default 8080; which avoids problems with your craft configuration).</p></li>
<li><p>Using Sequel Pro (phpMyAdmin), create two new databases. 'craft_domain' and 'craft_domain_subdomain'.</p></li>
<li><p>In each of the sites. </p>

<ul>
<li>Rename 'public/htaccess' to 'public/.htaccess'</li>
<li>Set permissions on the following folders and all contents to 777 (for now; will want this <a href="http://buildwithcraft.com/docs/installing#step-2-set-the-permissions" rel="nofollow noreferrer">more restrictive</a> on public servers)

<ul>
<li>craft/app</li>
<li>craft/storage</li>
<li>craft/config (technically only need it on the license.key file)</li>
</ul></li>
<li>(optional) delete 'web.config' from 'public' and 'craft' folders (assuming you don't need them)</li>
</ul></li>
<li><p>Open 'craft/config/db.php' and set the database connection details (server, port, user, password, database).</p></li>
<li><p>Open 'craft/config/general.php' and set your config settings, if any.</p></li>
<li><p>Open 'public/index.php' and confirm that $craftPath = '../craft'</p></li>
<li><p>Navigate to your site in the browser (domain.craft.dev) and (subdomain.domain.craft.dev) and follow on screen instructions to continue install.</p></li>
<li><p>Have a beer and celebrate. (maybe 2... one for each site?)</p></li>
</ol>

<p>(Did I miss anything?)</p>

<p>Advanced. For steps 6, 7 and 8 above, I actually use a slightly different setup. Instead I use this <a href="http://craftcookbook.net/recipes/273" rel="nofollow noreferrer">multi-environment configuration method</a> from the craft cookbook site which allows you to define your environments from within your 'index.php' file; combined with Ben Parizek's technique as described in <a href="https://craftcms.stackexchange.com/a/4734/784">this answer</a> for automatically configuring 'siteUrl' and 'basePath' environment variables. Note: doesn't work well if MAMP is set to serve on port 8080.</p>

CC BY-SA 3.0
2015-04-26T17:52:23.040Z
:) Thanks. What I've noticed in step 7.? Maybe you know, but If you custom set cpTrigger, than you won't be able to run install from domain.com/admin, but from domain.com/customCPtrigger. I didn't carry on installation, I rather commented in the settings in general.php. But great tutorial @Douglas McDonald
Dominik Krulak
CC BY-SA 3.0
2015-04-26T16:18:08.110Z
2015-04-26T16:49:23.773Z
2017-04-13T12:51:00.160Z
Douglas McDonald
<p>Get a copy of MAMP Pro and save yourself the hassle of creating virtual hosts, hacking /etc/hosts, etc. </p>

<p>I do 90% of what Douglas does but with some slight modifications, mostly to simplify permissions.</p>

<h3>Serve out of your own Sites folder:</h3>

<p>Set up a new site in ~/Sites. Then when you're creating a new subdomain, just point MAMP to the public folder inside of that subdomain. So inside ~/Sites it'll look like:</p>

<p><code>New Site (whatever.craft.dev)
   - craft
   - public</code> &lt;-- point MAMP to this folder.</p>

<p><code>Another new site (another.craft.dev)
   - craft
   - public</code></p>

<h3>Run Apache/nginx as the current user:</h3>

<p>That way you don't have to wrestle with permissions since Apache (or nginx) will run as the account that you're logged into. </p>

<h3>As an aside:</h3>

<p>Mac OS X used to ship with a copy of BIND so you could do wildcard DNS. That would allow you to setup one virtual host block and use Apache to do something like:</p>

<p><code>&lt;Virtualhost *:80&gt;
      VirtualDocumentRoot /Users/yourusername/Sites/%0/public/
 &lt;/VirtualHost&gt;</code></p>

<p>... basically mapping the hostname to the folder, so all you have to do when making a new dev site is to create a new dev folder (like <code>mynewsite.craft.dev</code>). Some <a href="http://passingcuriosity.com/2013/dnsmasq-dev-osx/" rel="nofollow">more reading</a> on that.</p>

CC BY-SA 3.0
2015-04-27T17:32:38.887Z
+1 for going MAMP Pro. The license is cheap and its *a lot* more flexible than the free version.
Mats Mikkel Rummelhoff
CC BY-SA 3.0
2015-04-28T17:16:22.113Z
Exactly, creating virtual hosts is main reason, why I've chosen MAMP server. And thanks for the tutorial @RitterKnight.
Dominik Krulak
CC BY-SA 3.0
2015-04-27T17:27:37.817Z
2015-04-27T17:27:37.817Z
RitterKnight
<p>I was playing around that quiet long time, because I didn't want to post the question right away I encounter on some difficulties. But here I go.</p>

<p><strong>The goal</strong></p>

<p>is to have separate craft installs for each subdomain.</p>

<p><strong>The problem</strong></p>

<p>When I hit enter to start installation, I get this <strong>The requested URL /admin was not found on this server.</strong> Have tried with *index.php?p=admin *, but with no effect.</p>

<ol>
<li>I've set up virtual host <em>subdomain.craft.dev</em></li>
<li>Checked, if the host loads anything. It does.</li>
<li><p>Uploaded public files to <em>subdomain.craft.dev</em> and edited </p>

<p><code>// Path to your craft/ folder
$craftPath = '../subdomain.craft/craft';</code></p>

<p>P.S Could I simply use <code>$craftPath = '../subdomain.craft';</code>? I've tried it at first without positive results.</p></li>
<li><p>Created folder <em>subdomain.craft</em> above the webroot. In it, uploaded <em>craft</em> folder and set the permission for required directories recursively.</p></li>
<li><p>Edited <em>db.php</em> to the needs of Craft's installation.</p></li>
<li><p>Run the install by visiting the host address <em>subdomain.craft.dev:8888/admin</em></p></li>
</ol>

CC BY-SA 3.0
2015-04-26T13:41:15.993Z
To me it sounds like either your hosts settings are off –_subdomain.craft.dev_ should have _/path/to/your/root/subdomain.craft/public/_ as its document root – or your Craft path is off (should be ```../craft``` for the above). What does the host "load" under 2)?
Mats Mikkel Rummelhoff
CC BY-SA 3.0
2015-04-26T14:01:23.863Z
I've loaded some image. Well, I run it on MAMP, and if you're OS X user, the 'public' files are located at /Applications/MAMP/subdomain.craft.dev/. The craft folder is described in point 4.
Dominik Krulak
<install>
Multiple Craft install configuration in subdomains
# Multiple Craft install configuration in subdomains

(Asked by: username_0 on 2015-04-26)

I was playing around that quiet long time, because I didn't want to post the question right away I encounter on some difficulties. But here I go.

**The goal**

is to have separate craft installs for each subdomain.

**The problem**

When I hit enter to start installation, I get this **The requested URL /admin was not found on this server.** Have tried with \*index.php?p=admin \*, but with no effect.

1. I've set up virtual host *subdomain.craft.dev*
2. Checked, if the host loads anything. It does.
3. Uploaded public files to *subdomain.craft.dev* and edited

   `// Path to your craft/ folder
   $craftPath = '../subdomain.craft/craft';`

   P.S Could I simply use `$craftPath = '../subdomain.craft';`? I've tried it at first without positive results.
4. Created folder *subdomain.craft* above the webroot. In it, uploaded *craft* folder and set the permission for required directories recursively.
5. Edited *db.php* to the needs of Craft's installation.
6. Run the install by visiting the host address *subdomain.craft.dev:8888/admin*

**Tags:** install
> **Comments:**
> **username_1**: To me it sounds like either your hosts settings are off –_subdomain.craft.dev_ should have _/path/to/your/root/subdomain.craft/public/_ as its document root – or your Craft path is off (should be ```../craft``` for the above). What does the host "load" under 2)?  
> **username_0**: I've loaded some image. Well, I run it on MAMP, and if you're OS X user, the 'public' files are located at /Applications/MAMP/subdomain.craft.dev/. The craft folder is described in point 4.  

---

## 2 answers

### Answer by username_2 on 2015-04-26. Score: 3 | Accepted answer

I also use MAMP. Here's my general process (I've used generic names in this example; but feel free to rename folders, hosts, as needed):

1. create the folders for your two sites:

   /Applications/MAMP/htdocs/domain.craft.dev
   /Applications/MAMP/htdocs/subdomain.domain.craft.dev
2. Download craft, unzip and copy the `public` and `craft` folders to your new folders:

   /Applications/MAMP/htdocs/domain.craft.dev/craft
   /Applications/MAMP/htdocs/domain.craft.dev/public
   /Applications/MAMP/htdocs/subdomain.domain.craft.dev/craft
   /Applications/MAMP/htdocs/subdomain.domain.craft.dev/public
3. Create two new hosts in MAMP, 'domain.craft.dev' and 'subdomain.domain.craft.dev'; set the 'document root' to the respective '/public' folders; start server. (I also have the server set to serve on port 80 instead of the default 8080; which avoids problems with your craft configuration).
4. Using Sequel Pro (phpMyAdmin), create two new databases. 'craft\_domain' and 'craft\_domain\_subdomain'.
5. In each of the sites.

   * Rename 'public/htaccess' to 'public/.htaccess'
   * Set permissions on the following folders and all contents to 777 (for now; will want this [more restrictive](http://buildwithcraft.com/docs/installing#step-2-set-the-permissions) on public servers)
     + craft/app
     + craft/storage
     + craft/config (technically only need it on the license.key file)
   * (optional) delete 'web.config' from 'public' and 'craft' folders (assuming you don't need them)
6. Open 'craft/config/db.php' and set the database connection details (server, port, user, password, database).
7. Open 'craft/config/general.php' and set your config settings, if any.
8. Open 'public/index.php' and confirm that $craftPath = '../craft'
9. Navigate to your site in the browser (domain.craft.dev) and (subdomain.domain.craft.dev) and follow on screen instructions to continue install.
10. Have a beer and celebrate. (maybe 2... one for each site?)

(Did I miss anything?)

Advanced. For steps 6, 7 and 8 above, I actually use a slightly different setup. Instead I use this [multi-environment configuration method](http://craftcookbook.net/recipes/273) from the craft cookbook site which allows you to define your environments from within your 'index.php' file; combined with Ben Parizek's technique as described in [this answer](https://craftcms.stackexchange.com/a/4734/784) for automatically configuring 'siteUrl' and 'basePath' environment variables. Note: doesn't work well if MAMP is set to serve on port 8080.

> **Comments:**
> **username_0**: :) Thanks. What I've noticed in step 7.? Maybe you know, but If you custom set cpTrigger, than you won't be able to run install from domain.com/admin, but from domain.com/customCPtrigger. I didn't carry on installation, I rather commented in the settings in general.php. But great tutorial @Douglas McDonald  

---

### Answer by username_3 on 2015-04-27. Score: 2

Get a copy of MAMP Pro and save yourself the hassle of creating virtual hosts, hacking /etc/hosts, etc.

I do 90% of what Douglas does but with some slight modifications, mostly to simplify permissions.

### Serve out of your own Sites folder:

Set up a new site in ~/Sites. Then when you're creating a new subdomain, just point MAMP to the public folder inside of that subdomain. So inside ~/Sites it'll look like:

`New Site (whatever.craft.dev)
- craft
- public` <-- point MAMP to this folder.

`Another new site (another.craft.dev)
- craft
- public`

### Run Apache/nginx as the current user:

That way you don't have to wrestle with permissions since Apache (or nginx) will run as the account that you're logged into.

### As an aside:

Mac OS X used to ship with a copy of BIND so you could do wildcard DNS. That would allow you to setup one virtual host block and use Apache to do something like:

`VirtualDocumentRoot /Users/yourusername/Sites/%0/public/`

... basically mapping the hostname to the folder, so all you have to do when making a new dev site is to create a new dev folder (like `mynewsite.craft.dev`). Some [more reading](http://passingcuriosity.com/2013/dnsmasq-dev-osx/) on that.

> **Comments:**
> **username_1**: +1 for going MAMP Pro. The license is cheap and its *a lot* more flexible than the free version.  
> **username_0**: Exactly, creating virtual hosts is main reason, why I've chosen MAMP server. And thanks for the tutorial @RitterKnight.  

---

