The Mijingo Blog

Latest news, updates, free tutorials, and more from Mijingo.

Develop SSL Sites Locally with MAMP

by Ryan Irelan

Local development of SSL sites with MAMP (see our course covering MAMP and other localhosting tools) takes just a few steps to set up. If you’re using MAMP (the free version) you will have to upgrade to MAMP Pro to set up SSL locally.

Here are the steps you need to take to set up an SSL site with MAMP Pro.

Create the Host

Just like we would with a non-SSL site, we have to create a new host first. In MAMP Pro we do this by clicking the + button at the bottom left of the main window. That will create a new entry in the Hosts listing. Name it whatever you want (I’m using mijingo.dev for my localhosting of this site).

If it’s not already, select the new host so you expose the hosting settings on the right side of the window.

I’m working under the assumption that you use the standard Apache ports for MAMP Pro (80 and 443). If you’re not, your site will not be available at the standard SSL port (443). I suggest running the same ports locally as you do in production, just so everything is the same.

Enable SSL

Next up is to enable SSL for our newly created host. With the host selected on the left, click the “SSL” tab on the right side of the MAMP main window.

Check the SSL box to enable SSL for this host. With SSL enabled we need to create certificates so we have an encrypted connection.

Fortunately, we don’t have to buy an SSL certificate for our local development (although, I suppose, we could). We can use what’s called a “self-signed certificate” instead.

A self-signed certificate means that we sign the certificate ourselves to verify its authenticity instead of going through a certificate issuing authority that verifies the certificate is indeed from us. Since we’re just using this locally–and not to serve any pages to the public–using a self-signed certificate if perfectly acceptable.

Create a Certificate file and key

There are two parts to creating an SSL certificate: a certificate file and the certificate key file. MAMP Pro makes it really straight-forward to create both.

Click the button “Create self-signed certificate…” and then fill out the form with your information. The form you input will only be used to create the certificate files on your computer and not sent anywhere.

Creating a Self-signed Certificate in MAMP Pro

After submitting the form, choose the location to save them. I typically choose the project directory or my computer user directory. MAMP Pro will create the certificate files and then add them to your config automatically.

MAMP Pro with SSL Certificates

Save your host file using the Save button.

Test the New Host

Confirm that MAMP Pro restarted the servers properly and then test the URL out in your browser. In my case I’d go to https://mijingo.dev/ and it should load the site properly over SSL and port 443.

Now that you have that done, learn more about localhosting in our free course Reliable Localhosting.

Filed Under: Free Tutorials, Localhosting