Sei sulla pagina 1di 3

1) Download and install wamp

a) For 64 bit http://www.wampserver.com/en/#wampserver-64-bits-php-5-6-25-


php-7
b) For 32 bit http://www.wampserver.com/en/#wampserver-32-bits-php-5-6-25

2) Download and install openssl for windows:


a) For 64 bit https://slproweb.com/download/Win64OpenSSL-1_1_0c.exe
b) For 32 bit https://slproweb.com/download/Win32OpenSSL-1_1_0c.exe

3) Copy and paste openssl.exe from C:\OpenSSL-Win64\bin to


C:\wamp64\bin\apache\apache2.4.23\bin

4) Copy and paste openssl.conf from C:\OpenSSL-Win64\bin\cnf to


C:\wamp64\bin\apache\apache2.4.23\conf

Note: Depending on the version of wamp and openssl you installed, the numbers in the
path address may change. So make necessary changes.

5) Open command promt (press Windows+R).

6) Go to the directory bin directory of apache.


Type cd C:\wamp64\bin\apache\apache2.4.23\bin

7) Generate a private key for server


Type: openssl genrsa -aes256 -out private.key 2048
A passphrase will be asked to enter. Enter a password that you can remember

8) Write the private key to a file named private.key


Type: openssl rsa -in private.key -out private.key

9) Generate a certificate for https


Type: openssl req -new -x509 -nodes -sha1 -key private.key -out certificate.crt -days 36500 -
config C:\wamp64\bin\apache\apache2.4.23\conf\openssl.cnf. This will generate
certificate.crt

10) Create a folder key_certficate in C:\wamp64\bin\apache\apache2.4.23\conf\ key

11) Copy the private.key and certificate.crt into


C:\wamp64\bin\apache\apache2.4.23\conf\key

12) Now need to make some changes in some files

a) Open httpd.conf from C:\wamp64\bin\apache\apache2.4.23\conf


- Uncomment the line that contains LoadModule socache_shmcb_module
modules/mod_socache_shmcb.so by removing the #
- Uncomment the line that contains LoadModule ssl_module
modules/mod_ssl.so by removing the #
- Uncomment the line that contains Include conf/extra/httpd-ssl.conf by
removing #

b) Open php.ini from C:\wamp64\bin\php\php5.6.25 and


C:\wamp64\bin\php\php7.0.10
- Uncomment the line that contains extension=php_openssl.dll by removing ;

c) Open httpd-ssl.conf from C:\wamp64\bin\apache\apache2.4.23\conf\extra and make


the following changes
- DocumentRoot C:\wamp64\www
- ServerName localhost:443
- ServerAdmin admin@example.com
- ErrorLog C:/wamp64/bin/apache/apache2.4.23/logs/ssl_error.log
- TransferLog C:/wamp64/bin/apache/apache2.4.23/logs/ssl_access.log
- SSLCertificateFile
C:\wamp64\bin\apache\apache2.4.23\conf\key\certificate.crt
- SSLCertificateKeyFile
C:\wamp64\bin\apache\apache2.4.23\conf\key\private.key

13) Type httpd t in cmd to check syntax

14) Open browser and type https://localhost

openssl req -new -config C://AppServ/Apache24/conf/openssl.cnf -out test.csr

openssl rsa -in privkey.pem -out test.key

openssl x509 -in test.csr -out test.cert -req -signkey test.key -days 365

#Listen 12.34.56.78:80
Listen 443

<VirtualHost *:443>
#Server Certificate:
SSLCertificateFile "C:/AppServ/Apache24/bin/test.cert"

#Server Private Key:


SSLCertificateKeyFile "C:/AppServ/Apache24/bin/test.key"

SSLEngine On

ServerName localhost
DocumentRoot "C:/AppServ/www/"
<VirtualHost _default_:443>

# General setup for the virtual host


DocumentRoot "c:/Apache24/htdocs"
ServerName www.example.com:443
ServerAdmin admin@example.com
ErrorLog "c:/Apache24/logs/error.log"
TransferLog "c:/Apache24/logs/access.log"

# SSL Engine Switch:


# Enable/Disable SSL for this virtual host.
SSLEngine on

# Server Certificate:
# Point SSLCertificateFile at a PEM encoded certificate. If
# the certificate is encrypted, then you will be prompted for a
# pass phrase. Note that a kill -HUP will prompt again. Keep
# in mind that if you have both an RSA and a DSA certificate you
# can configure both in parallel (to also allow the use of DSA
# ciphers, etc.)
# Some ECC cipher suites (http://www.ietf.org/rfc/rfc4492.txt)
# require an ECC certificate which can also be configured in
# parallel.
SSLCertificateFile "c:/Apache24/conf/server.crt"
#SSLCertificateFile "c:/Apache24/conf/server-dsa.crt"
#SSLCertificateFile "c:/Apache24/conf/server-ecc.crt"

# Server Private Key:


# If the key is not combined with the certificate, use this
# directive to point at the key file. Keep in mind that if
# you've both a RSA and a DSA private key you can configure
# both in parallel (to also allow the use of DSA ciphers, etc.)
# ECC keys, when in use, can also be configured in parallel
SSLCertificateKeyFile "c:/Apache24/conf/server.key"
#SSLCertificateKeyFile "c:/Apache24/conf/server-dsa.key"
#SSLCertificateKeyFile "c:/Apache24/conf/server-ecc.key"

Potrebbero piacerti anche