Generating self-signed SSL certificate for apache on Windows Vista

7,969

You can install OpenSSL for Windows, which is free.

After installation, open command line (cmd.exe), go to installation directory and run appropriate openssl commands.

openssl.exe req -x509 -newkey rsa:2048 -keyout server.key -out server.crt -days 1000 -nodes

This generates server.key (private key for your Apache) and server.crt (self-signed certificate). Remember to protect your private key.

For installation to Apache2 (in Linux):

sudo a2enmod ssl
sudo a2ensite default-ssl
nano /etc/apache2/sites-enabled/default-ssl

Change correct paths to following lines (paths to your new key and certificate):

SSLCertificateFile    /etc/ssl/certs/ssl-cert-snakeoil.crt
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key

Save and run /etc/init.d/apache2 restart (or if your distribution uses some different way, not that command).

Share:
7,969

Related videos on Youtube

Lokesh Paunikar
Author by

Lokesh Paunikar

Updated on September 17, 2022

Comments

  • Lokesh Paunikar
    Lokesh Paunikar almost 2 years

    I do not have any idea how to generate self-signed SSL certificate for Apache on Windows Vista, but I have to do that.

    How I can do that?

  • afrazier
    afrazier over 13 years
    @Lokesh: No, you don't need to install OpenSSL separately. The openssl.exe tool (and required libraries) should be included with an SSL-enabled Apache distribution. Just go into Apache's conf\extra folder and edit the httpd-ssl.conf file, then make sure it's being Include'd from your main httpd.conf file.
  • Admin
    Admin over 3 years
    Hi... I am using Xampp on windows 10 and I got my certificate and key... By following another site this is my virtural host at httpd-vhosts.conf: <VirtualHost *:443> DocumentRoot "C:\Users\talin\Documents\Code\Web\Bugs!" ServerName alphatest.cf SSLEngine on SSLCertificateFile "C:\xampp\apache\cert\server.crt" SSLCertificateKeyFile "C:\xampp\apache\cert\server.key" </VirtualHost>
  • Admin
    Admin over 3 years
    My apache server doesn't start and i could find any errors in the log...