Digital Masters Magazine

Mastering Digital Arts for Web, Video, Mobile, IoT (and Space Travel)

  • Design
  • Photo
  • Video
  • Web
  • Code
  • UX
  • Mobile
Home Code Setting Up Apache Virtual Hosts on MAMP
Setting Up Apache Virtual Hosts on MAMP

May 8, 2011 By admin Leave a Comment

Setting Up Apache Virtual Hosts on MAMP

In order to comfortably edit several dynamic websites in Dreamweaver at the same time you do not need several teting servers. Instead, you can set up virtual hosts on your existing Apache installation. This will work with any popular distribution including MAMP, WAMP and XAMP. Today we will show you how to set up virtual hosts on MAMP.

1. Install MAMP

First, go to the official MAMP website and download your free copy of MAMP. Unzip the packgage, double-click the installer and follow the on-screen instructions.

MAMP installation
Installing MAMP and MAMP Pro

At this point, you should have a working installation of Apache with MySQL.
In order to manage your servers, locate a folder named MAMP in your Applications folder and double-click MAMP.app.

MAMP: stop servers
MAMP: stop servers

In order to complete the other steps you should stop your servers now.

2. Edit /etc/hosts on your Mac

Open the Terminal and type

sudo pico /etc/hosts

When prompted, enter the password of your administrator account.

Edit the file in a way that you see a result like this:

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost localhost2 localhost3
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost

Instead of localhost, localhost2, localhost3 you could actually put in the name of a project.

editing /etc/hosts on MAc OS X
editing /etc/hosts on Mac OS X

When you are done editing the /etc/hosts file, press Control-O in order to output your changes to the file.  When prompted to overwrite existing file, confirm with Return. The editor will overwrite the existing /etc/hosts file. Press Control-X to exit pico.

3. Edit the the httpd.conf file

Open the file httpd.conf located in /Applications/MAMP/conf/apache in a text editor of your choice (either TextEdit in plain text mode, TextWrangler or BBEdit will do).

Path to your Apache files in MAMP on OS X
Path to your Apache files in MAMP on OS X

Open the file httpd.conf located in /Applications/MAMP/conf/apache in a text editor of your choice (either TextEdit or BBEdit will do).

Navigate to the end of that file and enter this:

#NameVirtualHost *:8888
Include /Applications/MAMP/conf/apache/vhosts.conf

TechArmor iPhone 8 Protective Screen

This will ensure that Apache reads the contents of the vhosts.conf file you are going to create.

3. Create your vhosts.conf file

Create a new text file and save it in the Include path you defined in the previous step. Enter in it this code:

# Virtual Hosts
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any block.
#
# ServerAdmin webmaster@dummy-host.example.com
# DocumentRoot "/www/docs/dummy-host.example.com"
# ServerName dummy-host.example.com
# ServerAlias www.dummy-host.example.com
# ErrorLog "/private/var/log/apache2/dummy-host.example.com-error_log"
# CustomLog "/private/var/log/apache2/dummy-host.example.com-access_log common"
#
# ServerAdmin webmaster@dummy-host2.example.com
# DocumentRoot "/www/docs/dummy-host2.example.com"
# ServerName dummy-host2.example.com
# ErrorLog "/private/var/log/apache2/dummy-host2.example.com-error_log"
# CustomLog "/private/var/log/apache2/dummy-host2.example.com-access_log common"

ServerName localhost
DocumentRoot /Applications/MAMP/htdocs/

Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all

ServerName localhost2
DocumentRoot /Applications/MAMP/htdocs2/

Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all

ServerName localhost3
DocumentRoot /Applications/MAMP/htdocs3/

Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all

Save the file.

4. Create directories for virtual hosts

In Finder, navigate to /Applications/MAMP/. Create directories which will serve as documents folders for your virtual hosts:

htdocs2
htdocs3

MAMP Server path on Mac OS X
The location of MAMP Server on Mac OS X

5. Restart and verify

Restart MAMP services.
In order to verify that all is well, point your web browser to:
http://localhost2:8888/

MAMP success
This is what you will see when your configuration works out.

If you see anything at all which isn’t an error message of your browser, for example if you see this information:

Index of /
Apache/2.0.64 (Unix) PHP/5.3.5 DAV/2 Server at localhost2 Port 8888

you are done!
Now you can begin setting up Dreamweaver in order to use your new virtual hosts as testing servers for dynamic web pages.

Filed Under: Code, Web Tagged With: Adobe, Apache, Dreamweaver, Mac, MAMP, virtual hosts

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Zizo

Change language settings in Adobe Photoshop 2020

How to change the language of Adobe Photoshop

Apple MacBook Pro (16-Inch, 16GB RAM, 1TB Storage) - Space Gray

The new 16-inch MacBook Pro: Faster, slightly heavier but still ultra-light and #WorthTheWait

iPhone XS

The iPhone XS +++ An Insider Report +++ new 5.8-inch and 6.5-inch OLED iPhones +++ Codename D32 & D33

Disable Create a PIN in Windows 10

How to disable the Create a PIN prompt on Windows 10 for good

SEO keywords research tools: SkyFu.com

Get more free inbound clicks for qualifying leads from paid search. SEO research tools on steroids

Disable Create a PIN in Windows 10

Windows 10 can be very persistent in asking you to create a PIN “for your convenience”, but what if you don’t want to remember a PIN? What if you are happy with a password-based sign-in? Windows 10 won’t quit nagging you about the digits and there is no obvious way to prevent it from throwing […]

SEO keywords research tools: SkyFu.com

Looking for more organic traffic and better qualifying leads from paid search? Look no more.

Recent Posts

  • How to change the language of Adobe Photoshop
  • The new 16-inch MacBook Pro: Faster, slightly heavier but still ultra-light and #WorthTheWait
  • The iPhone XS +++ An Insider Report +++ new 5.8-inch and 6.5-inch OLED iPhones +++ Codename D32 & D33
  • How to disable the Create a PIN prompt on Windows 10 for good
  • Get more free inbound clicks for qualifying leads from paid search. SEO research tools on steroids

What’s up

ActionScript Adobe Adobe CC All-in-One WP Migration Angular 2 Apache Apple assistive technology CNAME crawl DNG Dreamweaver Event Viewer Google Google Analytics GPU HTML HTTP INTC Intel iOS iPhone JavaScript Microsoft Windows 10 OpenSSH OS X PayPal performance Photoshop PHP product key Qualcomm RAW redirects RSS SEO speed SSD Tim Cook TypeScript Wall Street Windows Windows 10 Windows 10 free upgrade WordPress

Categories

Archives

  • May 2020
  • November 2019
  • August 2018
  • November 2017
  • October 2017
  • March 2016
  • February 2016
  • January 2016
  • December 2015
  • November 2015
  • February 2015
  • November 2014
  • November 2013
  • October 2012
  • September 2012
  • August 2012
  • June 2011
  • May 2011
  • March 2011
  • May 2010
  • Home
  • Subscribe
  • Advertise
  • Privacy Policy
  • Legal
  • Contact Us

Copyright © 2022 ·Streamline Pro Theme · Genesis Framework by StudioPress · WordPress · Log in

Posting....