Install self signed ssl cert. on centos (https)

How to enable SSL on your Centos webserver!

Follow the steps bellow to create a new secure certificate for your website and enable https:

Centos 6.5

    1. First step is to check which modules are being used by apache2
      apachectl -M | grep ssl
    2. If module: ssl_module (shared) is loaded then we skip to step 3. If it is not loaded then we need to install it:
      yum -y install mod_ssl
      and restart apache:
      service httpd restart
    3. Create the folder where we will create the certificate:
      mkdir /etc/httpd/ssl
      and generate the certificate:
      openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/httpd/ssl/apache.key -out /etc/httpd/ssl/apache.crt
      while the certificate is being created you will be asked for some information (Country Code, Organization name e.t.c.) just fill out any information you want.
    4. This step is done to add the certificate to apache, we need to edit:
      vim /etc/httpd/conf.d/ssl.conf
      find the section: VirtualHost _default_:443 and under it add:
      where you can replace with your own fully qualified domain name.
      Then find the following parameters and set exactly what you see bellow:
      SSLEngine on
      SSLCertificateFile /etc/httpd/ssl/apache.crt
      SSLCertificateKeyFile /etc/httpd/ssl/apache.key
  1. Final step restart apache:
    service httpd restart
    Visit your website with https!

Self signed certificate is not advised to be installed on public websites as it is not a trusted certificate. That means that it will more likely confuse your visitors than trust the website.
It is highly recommended for private usage as it will secure your connection the same way a trusted one will.