Why is this important?

It looks like the BluePrint-Q preview is broken on the WordPress themes directory:

https://wordpress.org/themes/blueprintq-draft/

Turns out that some assets are expecting to be loaded through http, but the theme directory is using https, which is causing the unpleasant layout. So, this is something I want to debug locally. Out of the box, WAMP does not easily support SSL (https). Try going to https://localhost and you’ll see something about ERR_CONNECTION_REFUSED.

 

The steps for setup, version 1

The first time I went through this, this is what worked for me:

Step 1

Download and install the 64-bit developer version of openssl:

Step 2

Open a command prompt and type the following:

set OPENSSL_CONF=c:\OpenSSL-Win32\bin\openssl.cfg

Step 3

Navigate to C:\wamp\bin\apache\apache2.4.9\bin and type the following:

openssl genrsa -aes256 -out private.key 2048
  • pass = <whatever>
openssl rsa -in private.key -out private.key
  • pass = <whatever>
openssl req -new -x509 -nodes -sha1 -key private.key -out certificate.crt -days 36500 -config C:\wamp\bin\apache\apache2.4.9\conf\openssl.cnf
  • country = US
  • state = FL
  • locality = <blank>
  • organization = <blank>
  • unit = <blank>
  • common = <blank>
  • email = <blank>

Step 4

In Windows Explorer, navigate to C:\wamp\bin\apache\apache2.4.9\bin and copy these two files to your clipboard:

certificate.crt
private.key

Now navigate to C:\wamp\bin\apache\apache2.4.9\conf\key and paste the files from your clipboard.

(note that the “key” folder is something that may not be created already)

Step 5

Open C:\wamp\bin\apache\apache2.4.9\conf\httpd.conf and uncomment the following lines (remove the ‘#’):

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

Step 6

Open C:\wamp\bin\php\php5.5.12\php.ini and uncomment the following line (remove the ‘,’):

extension=php_openssl.dll

(do the same in C:\wamp\bin\apache\apache2.4.9\bin\php.ini)

Step 7

Open C:\wamp\bin\apache\apache2.4.9\conf\extra\httpd-ssl.conf and do the following:

Find this line:

<VirtualHost _default_:443>

Update the section underneath to look like this:

DocumentRoot "C:/wamp/www"
ServerName localhost:443
ServerAdmin admin@example.com
ErrorLog "C:/wamp/bin/apache/apache2.4.9/logs/ssl_error.log"
TransferLog "C:/wamp/bin/apache/apache2.4.9/logs/ssl_access.log"

Find this line:

# Per-Server Logging:

Update the CustomLog path to:

C:/wamp/bin/apache/apache2.4.9/logs

Find this line:

# Server Certificate:

Update the uncommented line found under that heading to:

SSLCertificateFile "C:/wamp/bin/apache/apache2.4.9/conf/key/certificate.crt"

Find this line:

# Server Private Key:

Update the uncommented line found under that heading to:

SSLCertificateKeyFile "C:/wamp/bin/apache/apache2.4.9/conf/key/private.key"

Step 8

Go back to the command prompt at C:\wamp\bin\apache\apache2.4.9\bin and type the following:

httpd -t

If the output displays “Syntax OK”, then you have no errors and the recent steps you have taken appear accurate.

 

The steps for setup, version 2

Then I revisited a year later with a different computer and found issues with the “version 1” steps.  Here were the pitfalls I ran into and how I got over them.

Amendment 1

Now working on Windows 10, use the x64 version of OpenSSL instead of x86.  This means that the directory “OpenSSL-Win64” is used instead of “OpenSSL-Win32”.

Amendment 2

Now working on Windows 10, use the x64 version of OpenSSL instead of x86.Open a command prompt and type the following:

set OPENSSL_CONF=c:\OpenSSL-Win32\bin\openssl.cfg

Amendment 3

The process was now failing when trying to generate the certificate.  I received an error:

The ordinal XXX could not be located in the dynamic link library SSLEAY.DLL

To fix this, when installing OpenSSL, no longer choose “system”.  Instead, choose to install in the bin of the folder where OpenSSL is being installed.

Amendment 4

In httpd.conf, also ensure that this line is uncommented:

Include conf/extra/httpd-ssl.conf

Amendment 5

When everything is done, WAMPServer will not completely restart (i.e. the icon in the system tray will be yellow/orange, but not green).  This is due to an error in the various files that have been edited.  To find out what is wrong, go to c:/wamp/bin/apache/apache2.4.23/bin in Command Prompt and type:

httpd -t

In my case, I am using PHP 5.6.x and I saw an error like this:

Cannot load modules/mod_ssl.so into server: The operating system cannot run %1

In short, there is a version mismatch somewhere between PHP, Apache, or OpenSSL.  Really sloppy that one or more of these big-name tech has things mispackaged.  To fix this, copy:

libeay32.dll and ssleay32.dll

From c:/wamp/bin/php/php7.x to c:/wamp/bin/apache/apache2.4.x/bin.  Note that real files are copying over symlinks in this case.

 

Sources

I found probably thirty places with information, but most of it did not work or was incomplete.  Here’s the two that I primarily used – one is a more comprehensive video and the other deals with an environment variable.