How to enable SSL for Localhost with MAMP


URLs and other web page elements such as CSS and JavaScript are expressed via the https protocol. So how do I enable SSL in Localhost? In this article, Taimienphi.vn will guide you how to enable SSL for Localhost using MAMP.


Installing an SSL (Socket Secure Layer) certificate is one way to protect your website. SSL basically encrypts data transactions between the browser and the server. So you can test your website in SSL environment right from the development stage.

However, the URL and other elements of a web page such as CSS and JavaScript are clearly expressed via the https protocol. So in this article Taimienphi.vn will guide you how to enable SSL for Localhost using MAMP.

Activate SSL

Launch MAMP and create a VirtualHost with a custom domain name, this domain can be set as an extension such as .dev or .local.

Each VirtualHost you create in MAMP will have its own options for you to configure.

To enable SSL for VirtualHost, visit Access the SSL tab and tick the option SSL. Then locate the SSL certificate files (SSL certificate). If you already have an SSL certificate, locate and specify the files. If not, click the button Self-Signed Certificate Let MAMP create the certificates for you.

To create an SSL certificate, MAMP will ask you for some information like the country code and the country you live in to assign in the certificate:

how to enable ssl for localhost with mamp 2

Save the file to the appropriate directory and SSL is set.

how to enable ssl for localhost with mamp 3

Set Chrome browser to recognize your website

After enabling SSL for Localhost using MAMP, you can view your website through the protocol https. However on the screen you will see the error message shown as below. This is because the Chrome browser does not recognize your SSL certificate.

Note that if you run WordPress-based websites, you need to edit the item siteurl and home Enter from the table wp_options in the database.

how to enable ssl for localhost with mamp 4

If you encounter website reliability issues, you visit the option Advanced, then click Proceed to {your website name} to see his site.

If the red X appears on the Chrome browser, you must force Chrome to trust the certificate you created:

First, click the keychain icon with a red X icon, then click the link Certificate Information. On the Chrome window will display a popup window containing all the SSL certificate information specified in the site. Drag and drop the certificate icon to the desktop.

If you use Mac OS X, when you open the certificate file, you will be taken to the Keychain Access application.

how to enable ssl for localhost with mamp 5

Click here Always Trust. Select your website certificate, then click the button [i] to show details of the trustworthiness of a certificate. In Trust tab, you will see the option When using this certificate.

The default option value is set to Use Custom Settings. To make your certificate trusted, set the value of this option to Always Trust, and you will be prompted to enter your password again to update this setting.

how to enable ssl for localhost with mamp 6

Everything was set up as done. Finally reopen your website in Chrome browser, now you will see a green lock icon. That is, your SSL certificate is recognized as a trusted certificate.

how to enable ssl for localhost with mamp 7

https://thuthuat.taimienphi.vn/cach-kich-hoat-ssl-cho-localhost-bang-mamp-29080n.aspx
So Taimienphi.vn has shown you how to enable SSL for Localhost with MAMP. When your SSL certificate is recognized as a trusted certificate is also a way to protect your website, so you should implement SSL and HTTPS on WordPress Enhance security more. If you have any comments or questions, please leave your comments in the comment section below the article.

.

Add a Comment

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