. . .

Installing Self-Signed SSL Certificate on WAMP Server

Published: February 14, 2011

On This Page

     Part I: Creating SSL Certificate

    1- download windows executable file for openssl from http://slproweb.com/products/Win32OpenSSL.html and install it

    2- open cmd window 

    3- cd to [openssl installation directory]/bin e.g if your installation directory is C:Program FilesOpenSSl, then cd to C:Program FilesOpenSSlbin

    3- type in following commands

        a) openssl genrsa -out privkey.pem
        
        b) openssl req -new -key privkey.pem -out cert.csr
            It will ask you few questions, answer them as directed    

                [enter your private key password]
                [enter your two character country code]
                [enter your full state or province name]
                [enter your city name]
                [enter your company name]
                [enter your organizational unit or leave it blank]
                [enter your common name or fqdn]
                [enter your admin email address]
                [leave the rest of the attributes blank]

        c) openssl req -new -x509 -key privkey.pem -out cacert.pem -days 1095

            It will again ask few questions again. Provide the appropriate answers.

    Part II: Configuring Apache/PHP:

    (Note: Next steps assume that you have installed wamp at D:)

    1 – Copy cert.csr, cacert.pem, privkey.pem from your bin directory to any appropriate directory e.g. d:wampbinapacheapache2.2.6confssl

    2- Open your httpd.conf file. You need to make following changes…

        a) In httpd.conf file, remove the comment ‘#’ at the line which says: LoadModule ssl_module modules/mod_ssl.so 

        b) In httpd.conf, remove the comment ‘#’ at the line which says: Include conf/extra/httpd_ssl.conf. Then move that line after this block <IfModule ssl_module>…. </IfModule>     

    3- open the php.ini file, remove the comment ‘;’ at the line which says: extension=php_openssl.dll 

    4- Open your conf/extra/httpd_ssl.conf file. You need to make following changes…
        
        a) Find the line which says "SSLMutex…." and change it to "SSLMutex default" without quotes 

        b) Change the paths provided for DocumentRoot, ErrorLog, TransferLog, and CustomLog to 
            DocumentRoot "D:/wamp/www"
            ErrorLog "D:/wamp/logs/error_log"
            TransferLog "D:/wamp/logs/access_log"
            CustomLog "D:/wamp/logs/ssl_request_log"

        c) Change the line "SSLCertificateFile …." to 
            SSLCertificateFile "D:/wamp/bin/apache/apache2.2.6/conf/ssl/cacert.pem"     
            
        d) Change the line "SSLCertificateKeyFile …." to 
            SSLCertificateKeyFile "D:/wamp/bin/apache/apache2.2.6/conf/ssl/privkey.pem" 
        
        e) Change the line <Directory "C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin"> to <Directory "D:/wamp/www/"> and add the following lines inside <Directory>…</Directory> tags:

            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Order allow,deny
            allow from all 

        f) add following line after the line that says "AddType application/x-x509-ca-cert .crt"
            AddType application/x-x509-ca-cert .pem

    5 – Restart the Apache server

    Don't forget to share this post

      Let's Build Digital Excellence Together


      • Cost Efficient Solutions.
      • Minimal Timelines.
      • Effective Communication.
      • High Quality Standards.
      • Lifetime Support.
      • Transparent Execution.
      • 24/7 Availability.
      • Scalable Teams.

      Join Our 200+ Happy Clients Across Globe


      Free Consultation.

        Do you need tech help of your startup/business? Experts from our team will get in touch with you.

        Please do not post jobs/internships inquiries here.