Installing an SSL certificate on your XAMPP self-hosted website is essential to ensure secure communication between your website and its visitors. SSL (Secure Sockets Layer) encrypts the data transmitted between the server and the client, protecting it from potential threats. In this article, we will guide you through the process of installing an SSL certificate on your XAMPP self-hosted website.
Step 1: Generate a Certificate Signing Request (CSR)
The first step in installing an SSL certificate is to generate a Certificate Signing Request (CSR). A CSR is a file that contains your website's public key and other identifying information. Follow these steps to generate a CSR:
- Open XAMPP control panel and start the Apache server.
- Launch a web browser and enter "localhost" or "127.0.0.1" in the address bar.
- Click on "phpMyAdmin" to open the database management interface.
- Select the database associated with your website.
- Click on the "SQL" tab and execute the following SQL query:
CREATE TABLE ssl_csr (id INT AUTO_INCREMENT PRIMARY KEY, domain VARCHAR(255), csr TEXT); - Now, execute the following SQL query to create a new entry in the table:
INSERT INTO ssl_csr (domain) VALUES ('yourdomain.com');
Replace "yourdomain.com" with your actual domain name. - Next, execute the following SQL query to generate the CSR:
UPDATE ssl_csr SET csr = (SELECT CONCAT('-----BEGIN CERTIFICATE REQUEST----- ', 'Your CSR code here ', '-----END CERTIFICATE REQUEST----- ') FROM DUAL) WHERE domain = 'yourdomain.com';
Replace "Your CSR code here" with the actual CSR code you obtained from your SSL certificate provider.
Step 2: Install the SSL Certificate
Once you have obtained the SSL certificate from your certificate provider, you can proceed with installing it on your XAMPP self-hosted website:
- Copy the SSL certificate file (usually in .crt or .pem format) to a secure location on your server.
- Open XAMPP control panel and stop the Apache server.
- Navigate to the XAMPP installation directory and locate the "apache" folder.
- Inside the "apache" folder, locate the "conf" folder and open the "httpd.conf" file in a text editor.
- Search for the following line:
#LoadModule ssl_module modules/mod_ssl.so
Remove the "#" at the beginning of the line to uncomment it. - Search for the following lines:
#Include conf/extra/httpd-ssl.conf
#Include conf/extra/httpd-vhosts.conf
Uncomment both of these lines by removing the "#" at the beginning of each line. - Save the changes and close the file.
- Open the "httpd-ssl.conf" file located in the same "conf" folder.
- Search for the following lines:
SSLCertificateFile "conf/ssl.crt/server.crt"
SSLCertificateKeyFile "conf/ssl.key/server.key"
Replace both file paths with the absolute path to your SSL certificate file and private key file, respectively. - Save the changes and close the file.
- Start the Apache server from the XAMPP control panel.
Step 3: Verify the SSL Installation
Now that you have installed the SSL certificate, it's important to verify if it is working correctly:
- Launch a web browser and enter "https://localhost" or "https://127.0.0.1" in the address bar.
- If your SSL certificate is installed correctly, you should see a padlock icon in the browser's address bar indicating a secure connection.
- Click on the padlock icon to view the SSL certificate details.
- Ensure that the certificate details match your website's domain name and other relevant information.
Congratulations! You have successfully installed an SSL certificate on your XAMPP self-hosted website. Your website is now secured with SSL encryption, providing a safe browsing experience for your visitors.
References
| Number | Source |
|---|---|
| 1 | https://www.apachefriends.org/index.html |
| 2 | https://www.phpmyadmin.net/ |