How to Install SSL Certificate on XAMPP
Tags: tutorial, security, laravel, webdev
Published: 2021-05-29 00:53:45

**Install** **XAMPP** **SSL** - In some cases, a developer requires the presence of an SSL certificate on his local server to build a system or program that does require an SSL certificate or the HTTPS protocol. How to install SSL or HTTPS on localhost XAMPP? Following are the steps;

1. Open your terminal
![How to Install SSL Certificate on XAMPP](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x4m0wpg78r7z3nd1b9dc.png)
2. Type makecert as shown above.
![Install SSL Certificate on XAMPP](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8a9i460zj15ssfegvois.png)
3. Enter the PEM pass phrase or enter the password. Enter a password that is easy to remember because in the next step we are asked to enter a verification password.
![Install Https on XAMPP](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sb7w1u98c25dj6rejbjw.png)
4. Verify the password or type the password again as in step 3.
![step by step Install Https on XAMPP](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y56r9k1kuvxbjn12wt5c.png)
5. Type as shown above. If there is a command other than the picture above, you can just ENTER.
![step by step Install SSL Certificate on XAMPP](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yokkp0ashxc80tf7vh1p.png)
6. Enter the password again as was done in numbers 3 and 4.
 
7. Configure the file by going to **C:\xampp\apache\conf\extra**
 
8. Open the httpd-xampp.conf file
 
9. Add **SSLRequireSSL** to <Directory "C:/xampp/htdocs/xampp">, <Directory "C:/xampp/phpMyAdmin"> and <Directory "C:/xampp/webalizer">. So the httpd-xampp.conf file will look like the image below. If so, don't forget to SAVE.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w1hd3bupnlz67qv081ap.png)
10. Open **C:\xampp\apache\conf\extra**
 
11. Open the file **httpd-ssl.conf**
 
12. Find the **DocumentRoot** text. Then make changes as shown below
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8mlj84itaw2uu5bc9r16.png)

In DocumentRoot, adjust the location of your project and in ServerName change it to your liking. The purpose of the code above, when I enter the url www.geolocation.test it will display data from the DocumentRoot or our project.
 
13. If so, SAVE. Then restart Apache.
 
**DONE**
 
If our project uses the laravel framework, we usually need to include "/public" in the URL like https://geolocation.test/public. We can remove public URL in laravel by::
 
1. Move the **.htaccess** and **index.php** files to the root folder.
 
2. Open the **index.php** file

find code
```
require __DIR__.'/../vendor/autoload.php';
```
change into
```
require __DIR__.'/vendor/autoload.php';
```
And, find code
```
$app = require_once __DIR__.'/../bootstrap/app.php';
```
change into
```
$app = require_once __DIR__.'/bootstrap/app.php';
```
3. Save.
 
Now if I open it with the url https://geolocation.test it will display the default laravel display as shown below.
![remove public URL in laravel](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rd1dxlpuojnanjcp212r.png)

Thank's for your attention and don't forget to visit [Codelapan.com](https://codelapan.com), to get articles about web programming, web design, and others.