How to request and install a SSL certificate on Apache2

This post content will help you on how to request and install a SSL certificate on Apache2.

As you can see (or not :)), Shell{&}co is now using SSL. The first reason of this change is in this article : HTTPS as a ranking signal
… For these reasons, over the past few months we’ve been running tests taking into account whether sites use secure, encrypted connections as a signal in our search ranking algorithms. We’ve seen positive results, so we’re starting to use HTTPS as a ranking signal. For now it’s only a very lightweight signal — affecting fewer than 1% of global queries, and carrying less weight than other signals such as high-quality content — while we give webmasters time to switch to HTTPS. But over time, we may decide to strengthen it, because we’d like to encourage all website owners to switch from HTTP to HTTPS to keep everyone safe on the web…

This is the procedure on how to request (and buy) a ssl certificate and install it on your Apache2 web server :

  • On your web server, install openssl
  • Run the following command
    openssl req -nodes -newkey rsa:2048 -sha1 -keyout server.key -out server.csr
  • Go to your favorite certificate provider (for me RapidSSL was the cheapest provider)
  • Provide us the content of the previous generated file server.csr
  • Create a file server.crt and paste the certificate text provided by your CA
  • Edit your Apache vhost file (path : /etc/apache2/sites-enabled/something.conf) and insert the following lines
    
    	...
            SSLEngine on
            SSLCertificateFile /etc/apache2/server.crt
            SSLCertificateKeyFile /etc/apache2/server.key
            SSLCACertificateFile /etc/apache2/serverCA.crt
    	...
     
  • If you want to redirect all request from http to https, add these lines
    <VirtualHost *:80>
            ServerName server_hostname
            ServerAlias www.yourdomainname.ext
            Redirect / https://www.yourdomainname.ext
    </VirtualHost>
  • Save and exit the file
  • Launch the following commands to reload Apache2 configuration
    service Apache2 reload
  • And now, enjoy !

<>

My Powershell script categories

How to request and install a SSL certificate on Apache2

One thought on “How to request and install a SSL certificate on Apache2

Leave a Reply

Your email address will not be published.