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 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.