Skip to content

Instantly share code, notes, and snippets.

@shivai
Last active January 18, 2019 12:41
Show Gist options
  • Save shivai/ba8ef4b67dd07a26c030e812b9959799 to your computer and use it in GitHub Desktop.
Save shivai/ba8ef4b67dd07a26c030e812b9959799 to your computer and use it in GitHub Desktop.

Apache enable SSL

To enable ssl following these steps:

  1. Run the llowing commands:
 root@root#a2enmod ssl
 root@root#a2ensite default-ssl.cnf
  1. Make a directory in /etc/apache2/ and cd to it:
root@root#mkir /etc/apache2/ssl
root@root#cd /etc/apache2/ssl

Create self-sighned sertificate

  1. Make a certificate then create key and pem file
root@root#make-ssl-cert /usr/share/ssl-cert/ssleay.cnf apache.crt
root@root#cp apache.crt apache.pem
root@root#cp apache.crt apache.key
  1. Open the htaccess:
root@root#nano/etc/apache2/site-enable/default-ssl.conf

then add the change these line to:

SSLCertificateFile /etc/apache2/ssl/apache.crt
SSLCertificateKey /etc/apache2/ssl/apache.key

save and exit. 5. Restart the apache service:

root@root#/etc/init.d/apache2 restart
  1. Disable the http:
root@root#nano /etc/apache2/ports.conf

comment this line:

listen 80
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment