How to set up SSL certificate in local development apache

It was very difficult to setup SSL certificate for local environment in APACHE finally I got the solution. it takes 3 steps as follow

1. Generate Certificate:

mkdir \-p /etc/apache2/ssl
openssl req \-new \-x509 \-days 365 \-nodes \-out /etc/apache2/ssl/apache.pem \-keyout /etc/apache2/ssl/apache.pem
ln \-sf /etc/apache2/ssl/apache.pem /etc/apache2/ssl/`/usr/bin/openssl x509 \-noout \-hash < /etc/apache2/ssl/apache.pem`.0
chmod 600 /etc/apache2/ssl/apache.pem

2. Modify and add /etc/apache/ports.conf:


NameVirtualHost \*:443
Listen 443

3. add following code in vhost file:


SSLEngine On
SSLCertificateFile /etc/apache2/ssl/apache.pem
DocumentRoot /pfad/zum/Webinhalt

Leave a Reply

Your email address will not be published. Required fields are marked *