n.b. You need to download and install both MAMP and MAMP Pro
-
Under
General
in the preferences clickSet default MAMP ports
and hitSave
-
Open Terminal and stop Apache:
$ sudo apachectl stop
-
Restart MAMP Pro
-
Still under
General
clickSet ports to 80, 443 & 3306
and hitSave
-
Open Terminal and restart Apache:
$ sudo apachectl restart
- Under
Hosts
in the preferences, add whatever web apps or static sites you need. For example, I have aDev
directory in my home folder that I use to house all my local development work.
$ ls ~/Dev
website1 website2 website3
In MAMP Pro, I setup a new host for each, the only settings you need to change are the Server Name
and the Document root
.
After setting each one up and restarting the MAMP server I can then in my web browser can navigate to http://local.website1
, for example, without specifying the port number because we are using the default Apache port of 80
. I would recommend having a fullstop/period in there somewhere as some browsers and other situations may not recognise it as a URL if you don't.
Usually with the default MAMP (non-pro) settings, you would have to stop the servers, change the document root and then start the servers again. You can of course set up your own vhosts
file if you are confident with Apache configurations, this would take you some way to negating the need for MAMP Pro.
If you want to know what the Apache conifg looks like that MAMP Pro generates for you, it is located here: /Library/Application\ Support/appsolute/MAMP\ Pro/conf/httpd.conf
on my install around 50 lines from the end of the file. This is taken from my http.conf
file:
<VirtualHost *:80>
ServerName local.website1
DocumentRoot "/Users/euan/Dev/website1"
<IfModule xsendfile_module>
XSendFilePath "/Users/euan/Dev/website1"
</IfModule>
<Directory "/Users/euan/Dev/website1">
Options Includes FollowSymLinks ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
WSGIDaemonProcess local.website1 processes=2 threads=15
WSGIProcessGroup local.website1
WSGIScriptAlias /website1WsgiApp "/Users/euan/Dev/website1/wsgiapp.py"
</VirtualHost>