Enable SSL for Localhost using MAMP

Enable SSL for Localhost using MAMP

A SSL or Socket Secure Layer helps you to make your website secure. SSL can encrypt data transactions between the server and the browser. Hence, it is vital to check websites in a SSL environment in the very early steps of the site’s development.

URLs, CSS, JavaScript and other website assets are oriented through the https protocol. Due to this, the question on getting the SSL into localhost remains. The process requires few command lines, file modifications, configurations, and a few more tiring steps. MAMP Pro makes this even easier. It is noteworthy that MAMP is available in Windows now. Given below are the steps to set up a MAMP.

Enable SSL for Local host using MAMP
Enable SSL for Local host using MAMP

Enable the SSL

Launch the MAMP firstly. Then create a Virtual Host with a custom domain. This custom domain can be set up in extensions like .dev or .local. As an example, we have created www.hongkiat.dev which is used to host www.hongkiat.com.

Each virtual host created in MAMP will have the individual option on which you are able to do some configurations.

In order to enable SSL for the virtual host, go to the SSL tab and tick the SSL option. Thereafter, locate the SSL certificate files. If you found one, assign it. If not, click the ‘Create Self-Signed Certificate’ button. This allows MAMO to create the certificates for you.
In the creation process, you will be asked information like Country Code, State, etc. by the MAMP.

Save the file in proper folder. SSL is now set.

Make Chrome Trust Your Website
Once you have set the SSL, you should be able to view your website through the https protocol. However, you see an error message. This is because the SSL certificate is not recognized by the browsers. In our case, the browser is Google Chrome. For websites that runs based on WordPress, the site URL and the Home entry from the WP options table in the database should be modified.

You can go to the Advanced Option and click Proceed to (your website name) to view your website.

If the Red Cross shown in Chrome is annoying you continuously, you need to for Chrome to accept your generated certificate.

Firstly, click the crossed-padlock icon. Then click the Certificate Information link. A popup will be shown, including all the information of the SSL Certificate assigned in the website. Drag-Drop the certificate icon to your Desktop.

A Keychain App will be shown when your bring this certificate if your running OS X.

Select ‘Always Trust’ and select your website certificate. Then click the [i] button to reveal the details of the certificate Trust level. Under the Trust tab, go to the option ‘When using this certificate’. Change the value to ‘Always Trust’. You will have to provide your password to update these changes.

That’s all. If you reopen the website in chrome, you should see the green padlock.
Congratulations, your SSL certificate is now trusted.

Open MAMP Pro.

  1. In Server Tab Make Sure Your HTTP Port is 80 and HTTPS Port is 443
  2. Click on Hosts Tab
  3. Click On Plus Arrow for add new host.
  4. Add 127.0.0.1 As Hostname
  5. Click SSL Enable
  6. Select Directory Where is your htdocs or websites folder
  7. Click on SSL Tab
  8. Create Self Signed Certificate By Button Below.
  9. Then it will ask for save location after save it will select certificate auto.
  10. Restart your MAMP Server.

Enjoy!!!!

Type : https with localhost then you can see result.

Leave a Reply

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