How to Enable HTTPS / SSL on WAMP Server 3.2.0

Why Would I Need HTTPS / SSL on WampServer?

The time has come for all websites to migrate to HTTPS. Effective July 2018, Google’s Chrome browser will mark non-HTTPS sites as “not secure”. Google has been pushing webmasters to make the change to non-secure websites for many years now including hinting at small rankings boost. SSL stands for “Secure Sockets Layer” and when a website owner has one, all data passed between web browsers and servers is private and encrypted.

WAMP Server Training: Learn WAMP Server online. Courses as low as $9.99 at Udemy!

WampServer is a great tool for building a website on your local computer but as of right now it does not support HTTPS / SSL out of the box. Building your website from the ground up with HTTPS / SSL in mind can save you a lot of problems when you finally do put your site online. In the tutorial below, I will show you how to set up HTTPS / SSL for WampServer using OpenSSL.

Step 1: Download and Install WampServer

Wampserver is available in both 32 and 64 bit. Make sure you select the correct installer for your version of Windows. Wampserver is not compatible with Windows XP, SP3, or Windows Server 2003. The latest version of WampServer can be found here https://sourceforge.net/projects/wampserver/.

Step 2: Download and Install OpenSSL

OpenSSL is available in both 32 and 64 bit. Make sure you select the correct installer for your version of Windows. You can find the latest version of OpenSSL here https://slproweb.com/products/Win32OpenSSL.html. Navigate to your downloads folder and double click the installer. When Installing OpenSSL leave all settings default.

Step 3: Create Your Key and Certificate

Open your start menu and Load Command Prompt as an Administrator and run the following commands.

First, we will need to change our directory to where we installed OpenSSL.

cd c:/program files/openssl-win64/bin/

Next, we will create our private key. You will be asked for a passphrase. Make it anything you want just make sure you remember it for the next step.

openssl genrsa -aes256 -out private.key 2048
openssl rsa -in private.key -out private.key

Next, we will create our certificate. You will be asked several questions on this step. You can put whatever you like or just hit enter to leave it at default. The only one that really matters is Common Name (e.g. server FQDN) you will need to type “localhost” for this.

openssl req -new -x509 -nodes -sha1 -key private.key -out certificate.crt -days 36500

Step 4: Move Your Key and Certificate

Create a folder named “key” in the c:/wamp64/bin/apache/apache2.4.41/conf/ directory.

Navigate to c:/program files/openssl-win64/bin/ to find the certificate.crt and private.key that you just created. Both of these need to be moved to the new folder c:/wamp64/bin/apache/apache2.4.41/conf/key/.

Step 5: Edit Your httpd.conf File

Open c:/wamp64/bin/apache/apache2.4.41/conf/httpd.conf and un-comment (remove the #) the following 3 lines:

LoadModule ssl_module modules/mod_ssl.so
Include conf/extra/httpd-ssl.conf
LoadModule socache_shmcb_module modules/mod_socache_shmcb.so

Step 6: Edit Your httpd-ssl.conf File

Open c:/wamp64/bin/apache/apache2.4.41/conf/extra/httpd-ssl.conf and change all the parameters to the ones shown below.

DocumentRoot "c:/wamp64/www"
ServerName localhost:443
ServerAdmin [email protected]
ErrorLog "${SRVROOT}/logs/error.log"
TransferLog "${SRVROOT}/logs/access.log"
SSLSessionCache "shmcb:${SRVROOT}/logs/ssl_scache(512000)"
SSLCertificateFile "${SRVROOT}/conf/key/certificate.crt"
SSLCertificateKeyFile "${SRVROOT}/conf/key/private.key"
CustomLog "${SRVROOT}/logs/ssl_request.log"

DocumentRoot needs to be set to the location of your website files. ServerName can be “localhost” or however you choose to access the website in your web browser “example.com”.

Step 7: Restart WampServer

Everything should be set up now. Make sure you restart WampServer for the changes to take effect. If you see a green WAMP icon everything should be right. If the icon is orange there is a problem with your syntax somewhere.

You can run c:/wamp64/bin/apache/apache2.4.41/bin/httpd -t in command prompt and if there are any syntax errors they will be listed.

You should now be able to access your website with HTTPS / SSL enabled.

Keep in mind that you will still get a “not secure” warning in your web browser. Just add an exception and you will be able to access the website. This is a self-signed certificate and is for development purposes only.

WAMP Server Training: Learn WAMP Server online. Courses as low as $9.99 at Udemy!

If you enjoyed this tutorial, please be sure to follow us on Facebook and Twitter. You can also find us on Freelancer if you need some help with your WordPress website or web development issues.

More Great Tutorials

David Green

My name is David and I am the founder and author of Zuziko. I am passionate about web development and have created Zuziko as a way to share my knowledge and experience with the world.

35 thoughts on “How to Enable HTTPS / SSL on WAMP Server 3.2.0”

  1. Dima

    Realy helpful! Thx!

  2. Perfectly clear. Done in 3 minutes. Thank you !

  3. Julio

    Hello, I followed the steps, but when I go to https: // localhost, and decide to continue despite the warning, I don’t have the padlock, and the https is crossed out, what should I do?

  4. Thank you for a great post! Very accurate and helpful – Wow!

  5. For anyone who is having trouble configuring SSL with WampServer check out https://github.com/custom-dev-tools/WampServer-SSL-Auto-Config

    This batch script (with a simple to edit sample-config.ini file example) should make setup a breeze whilst also:

    1. Adding extra seperation between WampServer and your projects directories (noting ability for multiple domain setup).

    2. Adding self signed certificates to your windows certificate store (eliminating the need to accept exceptions / untrusted certificates) every time.

    3. Allowing URL friendly domain names (by updating your windows hosts file when run under administrator privileges).

  6. managed to follow your guide, but cant get it going, error is
    AH00526: Syntax error on line 129 of C:/wamp64/bin/apache/apache2.4.41/conf/extra/httpd-ssl.conf:
    SSLSessionCache cannot occur within section

  7. Lovro

    Just wanted to say thanks for a great tutorial

  8. DK

    Great tutorial.

    If anybody has any issues with syntax (like I did) check and recheck each of the edits to the httpd files and the issue should fix itself.

  9. Angelo Pera

    This article was great. I followed all the steps. During Testing, the Syntax was OK.

    But when I restart all the services of my WAMPServer the icon didn’t turn green.

    How will I solve this?
    Thanks

  10. mac

    Works ok, thank you.

  11. jon

    managed to follow your guide, but cant get it going, error is
    AH00526: Syntax error on line 129 of C:/wamp64/bin/apache/apache2.4.41/conf/extra/httpd-ssl.conf:
    SSLSessionCache cannot occur within section

    appreciate a feedback.. thanks

  12. James

    Hi,

    I followed the steps as mentioned. The index page is now being displayed but when I open a post or page, it displays WAMP homepage.

    How can I fix it?
    TIA.

  13. Tomdp

    Great tutorial, got it all working in a couple of minutes. Thanks a bunch.
    I’m bumping into one issue though, I use Google authentication which requires a SSL cert. cURL returns an error after login though : unable to get local issuer certificate. I think this has to do with the certificate validation?

  14. Hello,
    Thanks for the explanation, but unfortunately your method doesn’t work and caused the localhost server to halt and stopped working.

    The correct way to install the OpenSSL certificate on Localhost running with WAMP server by following the exact steps on this webpage:

    How to Enable Localhost HTTPS (SSL) on WAMP Server
    https://www.proy.info/how-to-enable-localhost-https-on-wamp-server/

    I just changed the apache version from apache2.4.23 to apache2.4.41 and everything is working great and the https server working without issues. Your method caused apache server to stop running.

    You may review the other steps and update this topic.
    Thank you.

    • Thank you for letting us and other readers know. We’ll have a look at the article you linked out to and see if we can reproduce the issue that you had, too.

  15. Timo

    Great article David! Got it working in no time. Just fantastic. Thanks for sharing this. 🙂

  16. Arjen

    Enter “chrome://flags/#allow-insecure-localhost” in your chrome browser and “Allow invalid certificates for resources loaded from localhost.” to bypass the security warning about your self signed certificate.

  17. Ilya Bakhlin

    Hello, David.

    First of all, thank you very much for the tutorial, it’s really helpful!

    On the other hand, I have the following question: how can I set up different certificates for my virtual hosts? Because the configuration you have shared here is applicable only to the default WAMP directory.

    Thank you very much!

    Regards.

    • David Green

      Hello Ilya,

      The same way that you can add multiple VirtualHost in the httpd-vhost.conf, you can also add them to the httpd-ssl.conf. You just have to manually do it in a text editor instead of using the WAMP icon.

      Copy the <VirtualHost _default_:443> below and paste it at the bottom of your httpd-ssl.conf file. Then, change the DocumentRoot, ServerName, Directory, etc. with your new project details.

      <VirtualHost _default_:443>
      DocumentRoot "c:/wamp64/www/wordpress"
      ServerName newproject.com:443
      ServerAdmin [email protected]
      ErrorLog "${SRVROOT}/logs/error.log"
      TransferLog "${SRVROOT}/logs/access.log"
      
      SSLEngine on
      
      SSLCertificateFile "${SRVROOT}/conf/key/certificate.crt"
      
      SSLCertificateKeyFile "${SRVROOT}/conf/key/private.key"
      
      <FilesMatch "\.(cgi|shtml|phtml|php)$">
          SSLOptions +StdEnvVars
      </FilesMatch>
      
      <Directory "${SRVROOT}/cgi-bin">
          SSLOptions +StdEnvVars
      </Directory>
      
      BrowserMatch "MSIE [2-5]" \
               nokeepalive ssl-unclean-shutdown \
               downgrade-1.0 force-response-1.0
      
      CustomLog "${SRVROOT}/logs/ssl_request.log" \
                "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
      
      </VirtualHost>
      
  18. João Paulo

    C:/wamp/bin/apache/apache2.4.23/bin/httpd -t

    httpd: Syntax error on line 184 of C:/wamp/bin/apache/apache2.4.23/conf/httpd.conf:
    Cannot load modules/mod_ssl.so into server: The operating system cannot run %1.

  19. Joseph Levin

    I was able to make the suggested modifications, and was met with a Syntax OK when performing the final check.

    After attempting to go to https://localhost in Google Chrome, I clicked the “Advanced” button to “Proceed to localhost (unsafe).”

    I was met with this error:

    Forbidden
    You don’t have permission to access / on this server.
    Apache/2.4.37 (Win64) OpenSSL/1.1.1a PHP/7.2.14 Server at localhost Port 443

    Any insight into this would be much appreciated!

    Thanks!

    • Joseph Levin

      Nevermind – this page had the fix for the 403 Forbidden Error:
      https://stackoverflow.com/questions/40591426/you-dont-have-permission-to-access-on-this-server-when-using-https

      I took the contents between the directory tags:

      Options Indexes FollowSymLinks MultiViews
      Require all granted
      AllowOverride none
      

      and placed it within the same area in my httpd-ssl.conf file, but after the entry that was already there.

      The end result of my edit looked like this:

      <Directory "c:/wamp64/www">
         SSLOptions +StdEnvVars
         Options Indexes FollowSymLinks MultiViews
         Require all granted
         AllowOverride none
      </Directory>
      

      and that did the trick!

      Thank you for providing this guide!

      • Zaki

        I did the same thing but I’m still getting the error “You don’t have permission to access / on this server.”

        BTW here is more info “Apache/2.4.35 (Win64) OpenSSL/1.1.0i PHP/7.2.10 Server at localhost Port 443.”

      • Michal Haltuf

        Worked for me and solved my problem. Thank you!

  20. Mat

    Hi,

    Only the command “Directory” was not working for me in Apache 2.4.33, so I couldn’t use the ${SRVROOT}, but with the debugger in Command Prompt it was easy.

    Thanks you.

    Mat.

  21. André

    Many thanks David for the tutorial. My localhost returned the message below:

    This page is not secure (broken HTTPS).
    Certificate – Subject Alternative Name missing
    The certificate for this site does not contain a Subject Alternative Name extension containing a domain name or IP address

    • David Green

      Hi André, you are receiving this error because this is a self-signed certificate.

      When you use a self-signed certificate there is no third-party Certificate Authority (Symantec, GlobalSign, Trustware, Comodo etc.) involved in signing the certificate and certifying your identity, so your web browser will indicate that the connection is not secure and advise you not to enter or transmit sensitive data such as credit card numbers, passwords, etc.

      On Google Chrome, click the “Advanced” button and “Proceed to localhost (unsafe).”

      On Firefox, click the “Advanced” button and “Add Exception” for https://localhost.

      This will allow you to access https://localhost even though the certificate is not trusted by your browser.

  22. Chris Dillon

    Many thanks David for the clear and concise tutorial. You definitely saved me time and frustration.

    However, the syntax highlighter buttons are not working (check JavaScript console).

    • David Green

      Glad I was able to help Chris! Thanks for letting me know about the highlighting issue. Everything should be working fine now.

  23. Steven Rodriguez

    This is the error I get now:

    AH00526: Syntax error on line 2 of C:/wamp64/bin/apache/apache2.4.37/conf/extra/httpd-ssl.conf:
    Invalid command ‘Directory’, perhaps misspelled or defined by a module not included in the server configuration

    • David Green

      Hi Steven, I was able to replicate your problem by removing the # from line 2.

      This is what line 2 of the httpd-ssl.conf should look like:

      # This is the Apache server configuration file providing SSL support.

      Replace line 2 with the code provided above and restart WAMP. If you are still getting errors, let me know.

      • MR.Mostafa

        I have the same problem.

        AH00526: Syntax error on line 125 of C:/wamp64/bin/apache/apache2.4.37/conf/extra/httpd-ssl.conf:
        Invalid command ‘Directory’, perhaps misspelled or defined by a module not included in the server configuration

        Line 125 is:

        Directory "c:/wamp64/www"
  24. rob

    “Can’t open “private.key” for writing, Permission denied”

    • David Green

      Hi Rob, make sure you Run Command Prompt as an Administrator and that should fix your problem.

      On windows 10 open your start menu. Type in cmd to search for Command Prompt. Right-click on it and select Run as Administrator.

Leave a Comment

Share via
Copy link
Powered by Social Snap