Configuring SSL in MAMP 2.0.5 (the free version)

I’ve been trying to configure my MAMP installation (NOT the paid version) to accept SSL for a recent project that I am working on. A lot of MAMP SSL tutorials are out dated and do not work for MAMP v2+ (2.0.5) and some just don’t seem to work so I had to do a lot of digging around.

Non-SSL traffic results in 400 error

My main problem was that all traffic was forced via SSL – http traffic was met with a 400 error. I only wanted part of my project to run on SSL.

Setting up MAMP for SSL – the basics

I found this site that helped with the bulk of the task of how to implement MAMP SSL:

It covers the following steps:

  • Back up your MAMP install, or at least your config files
  • Generate a self signed certificate to use in your dev environment
  • Uncomment the required lines in the httpd.conf
  • Define your SSL site in httpd-ssl.conf

It also covers editing your hosts file and setting up virtual hosts – useful if you are a first timer at this and something I have previously covered.

I won’t cover these parts again, but I will add some important extra info that solved some key issues that I ran into:

MAMP SSL Problems

First, uncommenting and using the httpd-vhosts.conf file does not seem to work for me. For some reason apache would not start despite much fettling with the virtual host declarations in the file. Not a problem, you don’t need it – just leave this line commented and define your virtual hosts at the bottom of the httpd.conf file.

Fixing MAMP config: non-SSL http 400 error

The big issue for me is that enabling SSL results in only SSL traffic being accepted by the server, so if you try to access your site using http://.. you will receive a 400 ‘bad request’ http error message. To enable non-http traffic to work, you must do the following:

In httpd.conf, instead of:

<VirtualHost *:80>
ServerName test-site.co.uk
DocumentRoot "/Applications/MAMP/htdocs/sitedocs"
</VirtualHost>

You have to be explicit in the site you are defining in the <VirtualHost> tag. You also need to declare ‘SSLDisable’.

Use this:

<VirtualHost test-site.co.uk:80>
SSLDisable
ServerName test-site.co.uk
DocumentRoot "/Applications/MAMP/htdocs/shop2"
</VirtualHost>

This allows your test site to accept both ssl and non-SSL traffic.

Other Stuff

One other interesting point that may be important if you want to run multiple SSL sites on MAMP:

In the Apache docs it states that name based virtual hosts do not work for SSL. You can have one SSL site and multiple non-SSL sites defined via virtual hosts, but for multiple SSL sits you must use IP-based virtual hosts – so you would have to configure the machine with multiple IPs. Probably not worth bothering with!.

Helpful docs

Key to finding out how to solve my 404 issue was this example settings page that shows how to set up a site on ssl and another, differently addressed non-SSL site, but the principles are largely the same.

Posted from London, England, United Kingdom.

Delivering web video to mobile devices..

Lately I’ve been trying to get Video on to mobile devices and it’s a maze of techniques, settings, programs and codecs for every device and device model so below I’ll try to clear up some missunderstandings and include codecs, settings and techniques for delivering web video on to some of the most popular devices of ..read more »

Posted from Lambeth, England, United Kingdom.

Load Balancing WordPress

When we moved to WordPress, we ran into an issue with our load balanced servers – you can’t add a post to each server individually because of the unique post number added by wordpress when you publish – the post will have a different URL on each server which, because traffic could go to any server, will result in ..read more »

Posted from High Wycombe, England, United Kingdom.

Controlling multiple machines..

If you have more than one machine on your desk, then Synergy might be the answer. It allows you to control multiple machines, with different operating systems (Win or Mac/Unix based) with just one keyboard and mouse. As you move the mouse off the edge of one screen, it appears on the screen of the machine next to it. Clever eh?

Posted from London, England, United Kingdom.

MAMP (LAMP) for Mac – Hosting Multiple Sites (without the pro version)

You don’t need to shell out for the pro version of MAMP to host multiple sites on your Mac. All it takes is a couple of tweaks behind the scenes. Once you have MAMP installed and working, configure MAMP to respond to web requests on port 80 (if you haven’t already done this). Next, simply edit your Mac’s hosts file to redirect your site URL’s to ..read more »

Posted from London, England, United Kingdom.

Cleaner, better javascript popups

This page shows a cool method for adding javascript popups to the links on your page, but only where needed and it doesn’t look messy either: http://www.quirksmode.org/js/popup.html#attributes

Office 2011

I finally made the move to office 2011 after using 2008 for waaaay too long and I have to say it is definitely worth it. Despite having 2008, I didn’t use entourage, the mac version of outlook, because it was bulky, slow and it didn’t really do much properly. Being a mac user, I don’t use an exchange server as I’ve never been able to do it reliably, so I ..read more »

Posted from Lambeth, England, United Kingdom.

Retro photo styles

Some nice tutorials on this site for finishing photo’s with some retro effects – there’s the ‘dark processed lomo‘ effect and the ‘Cool retro analog effect‘.

Had a crack with this pic of me airborne in Fleine. No, I didn’t land it!



Posted from London, England, United Kingdom.

Torn paper edge effect

This tutorial shows how to create a cool effect that I might use to give a nice torn paper edge effect to the fiberous paper blog-roll that I have been thinking about implementing as the background to my blogs here.

OS X Snow Leopard WiFi issues..

My MacBook Pro has been misbehaving of late – whilst other computers and my iPhone can faultlessly connect to any WiFi network, my MBP seems to grow tired of networks over a time period; First it started dropping connection to my Netgear wifi access point at home. Sometimes it would connect and wouldn’t get an IP address, other times it would appear to connect, but I couldn’t ..read more »

Posted from Lambeth, England, United Kingdom.