On Windows10, 11, How to enable https:// in Wamp
To enable HTTPS on your local WAMP server, you need to set up SSL/TLS certificates.
Windows 10, 11 WampServer https:// |
Have you recently purchased Godaddy wild card ssl certificate?!
Have you recently purchased Google SSL Certificate?
Have you been trying to enable https protocol in order to test alternatively on your local Windows11 system because the previous two options are too expensive?! 'This post is for you'
Here’s how to do it:
### Steps to Enable HTTPS on WAMP:
1. **Install OpenSSL** (if not already installed):
- WAMP comes with OpenSSL, but make sure it’s properly installed. You can check this by looking for the `openssl.exe` file inside your WAMP directory, usually found in `C:\wamp64\bin\apache\apache[version]\bin\`.
- If OpenSSL isn’t installed, download it from [OpenSSL's official site](https://www.openssl.org/) and install it.
2. **Generate SSL Certificates**:
- Open a command prompt and navigate to the OpenSSL directory inside your WAMP Apache folder:
```bash
cd C:\wamp64\bin\apache\apache[version]\bin
```
- Generate a private key:
```bash
openssl genpkey -algorithm RSA -out private.key
```
- Generate a self-signed certificate (valid for 365 days, you can adjust this as needed):
```bash
openssl req -new -x509 -key private.key -out certificate.crt -days 365
```
- During this process, you’ll be prompted to enter information like country, state, and common name (for `Common Name`, use `localhost`).
3. **Configure Apache to Use SSL**:
- Open the Apache configuration file in a text editor. This file is typically located at `C:\wamp64\bin\apache\apache[version]\conf\httpd.conf`.
- Make sure these two lines are uncommented (remove `#` at the start if they exist):
```bash
LoadModule ssl_module modules/mod_ssl.so
Include conf/extra/httpd-ssl.conf
```
- Save the file.
4. **Configure the SSL Settings**:
- Open the SSL configuration file, usually located at `C:\wamp64\bin\apache\apache[version]\conf\extra\httpd-ssl.conf`.
- Look for the following lines and update them accordingly:
```bash
SSLCertificateFile "${SRVROOT}/conf/ssl/certificate.crt"
SSLCertificateKeyFile "${SRVROOT}/conf/ssl/private.key"
```
- Replace `${SRVROOT}` with the path to your WAMP Apache folder, and ensure the paths point to where your `certificate.crt` and `private.key` files are stored.
5. **Update Virtual Host for HTTPS**:
- If you’re using virtual hosts, update or create a new virtual host for `localhost` to enable HTTPS. You can edit the virtual host configuration file located at `C:\wamp64\bin\apache\apache[version]\conf\extra\httpd-vhosts.conf`. Add this block:
```bash
<VirtualHost *:443>
DocumentRoot "C:/wamp64/www"
ServerName localhost
SSLEngine on
SSLCertificateFile "C:/wamp64/bin/apache/apache[version]/conf/ssl/certificate.crt"
SSLCertificateKeyFile "C:/wamp64/bin/apache/apache[version]/conf/ssl/private.key"
</VirtualHost>
6. **Restart WAMP**:
- Restart WAMP for the changes to take effect. You should now be able to access your local server via `https://localhost`.
7. **Bypass Browser Warnings**:
- Since this is a self-signed certificate, your browser will likely display a warning that the certificate is not trusted. You can bypass this warning by adding an exception (usually an option like "Proceed to localhost" in the browser).
### Testing HTTPS:
After completing these steps, you should be able to access your local WAMP server using `https://localhost`.