From now on, you should see a delightful lock next to https://konklone.com in your browser’s URL bar, because I’ve switched this site to use HTTPS. I paid $0 for the trouble.
Why you should bother doing the same:
This post shows how to do your part in building a surveillance-resistant Internet by switching your site to HTTPS. Though it takes a bunch of steps, each one is very simple, and you should be able to finish this in under an hour.
A quick overview: to use HTTPS on the web today, you need to obtain a certificate file that’s signed by a company that browsers trust. Once you have it, you tell your web server where it is, where your associated private key is, and open up port 443 for business. You don’t necessarily have to be a professional software developer to do this, but you do need to be okay with the command line, and comfortable configuring a web server you control.
Most certificates cost money, but at Micah Lee’s suggestion, I used StartSSL. They’re who the EFF uses, and their basic certificates for individuals are free. (They’ll ask you to pay for a higher level certificate if your site is commercial in nature.) The catch is that their website is difficult to use at first — especially if you’re new to the concepts and terminology behind SSL certificates (like me). Fortunately, it’s not actually that hard; it’s just a lot of small steps.
Below, we’ll go step by step through signing up with StartSSL and creating your certificate. We’ll also cover installing it via nginx, but you can use the certificate with whatever web server you want.
To get started, visit their signup page and enter your information.
They’ll email you a verification code. They tell you to not close the tab or navigate away from it, so just keep it open until you get the code, and can paste it in.
You’ll need to wait for certification, but it should only take a few minutes. Once you’re approved, they’ll email you a special link and a verification code to type in.
That’ll bring you to a screen to generate a private key. They’re generating you this private key inside your browser, using the “keygen” tag. However, this isn’t the key you use to make your SSL certificate. They’re using it to create a separate “authentication certificate” that you will use to log in to StartSSL’s control panel going forward. You’ll make a separate certificate for your website later.
Finally, they’ll ask you to “Install” the certificate:
Which installs your authentication certificate directly into your browser.
If you’re in Chrome, you should see this at the top of your browser window:
Again, this is just the certificate that identifies you by your email address and lets you log in to StartSSL going forward.
Now, we need to get StartSSL to believe we own the domain name we want to generate a new certificate for. From the control panel, click the “Validations Wizard” tab, and select “Domain Name Validation” from the dropdown.
Enter your domain name.
Next, you’ll select an email address that StartSSL will use to verify you own the domain name.
As you can see, StartSSL will believe you own the domain if you control webmaster@, postmaster@, or hostmaster@ with the domain name, OR if you own the email address listed as part of the domain’s registrant information (in my case, that’s currently
email@example.com). Choose an email address where you can receive mail.
They’ll email you a validation code, which you can enter into the field to validate the domain.
Now that StartSSL knows who you are, and knows you own a domain, you can generate your certificate using a private key.
While StartSSL can generate a private key for you — and their FAQ assures you they use only the highest quality random numbers and don’t hold onto the key afterwards — it’s also easy to create your own.
This guide will cover creating your own via the command line. If you choose to let StartSSL’s wizard do it, you can pick back up with this guide a couple steps down, where you choose the domain the certificate should apply to.
To create a new 2048-bit RSA key, open up your terminal and run:
openssl genrsa -aes256 -out my-private-encrypted.key 2048
You’ll be asked to choose a pass phrase. Pick a good one, and remember it. This will generate an encrypted private key. If you ever need to transfer your key, via the network or anything else, use the encrypted version.
The next step is to decrypt it so that you can generate a “certificate signing request” with it. To decrypt your private key:
openssl rsa -in my-private-encrypted.key -out my-private-decrypted.key
Now, generate a certificate signing request:
openssl req -new -key my-private-decrypted.key -out mydomain.com.csr
Go back to StartSSL’s control panel and click the “Certificates Wizard” tab, and select “Web Server SSL/TLS Certificate” from the dropdown.
Since we generated our own private key, you can hit “Skip” here.
Then, paste in the contents of the .csr file we generated earlier.
If all goes well, it should say it received your certificate signing request.
Now, choose the domain you validated earlier which you plan to use with the certificate.
It requires you to add a subdomain. I added “www” for mine.
It will ask you to confirm. If it looks right, hit “Continue”.
Note: It's possible you'll get hit with a "Additional Check Required!" step here, where you wait for approval by email. It didn't happen to me the first time, but did the second time, and my approval arrived in ~30 minutes. Upon approval, you'll need to visit the "Tool Box" tab and visit "Retrieve Certificate" to get your cert.
That should do it — your certificate will appear in a text field for you to copy and paste into a file. Call it whatever you want, but the rest of the guide will refer to it as
First, make sure port 443 is open on your web server. Many web hosts automatically keep this port open for you. If you’re using Amazon AWS, you’ll need to make sure your instance’s Security Group has port 443 open.
Next, we’re going to create the “certificate chain” that your web server will use. It contains your certificate, and StartSSL’s intermediary certificate. (Including StartSSL’s root cert is not necessary, because browsers ship with it already.) Download the intermediate certificate from StartSSL:
Then concatenate your certificate with theirs:
cat mydomain.com.crt sub.class1.server.ca.pem > unified.crt
Finally, tell your web server about your unified certificate, and your decrypted private key. I use nginx — below is the bare minimum nginx configuration you need. It redirects all HTTP requests to HTTPS requests using a 301 permanent redirect, and points the server to the certificate and key.
Now, ensure your nginx configuration is okay (this also verifies that the key and certificate are in working order):
sudo nginx -t
Then restart nginx:
sudo service nginx restart
Cross your fingers and try it out in your browser! If all goes well, the will be yours.
Many common hosts don’t give you direct access to install a certificate yourself. In that case, you’ll probably have to pay $$ for HTTPS, if it’s possible at all.
If you use:
If you need to look elsewhere because your host makes it too expensive or impossible to set up HTTPS, another option is to sign up for CloudFlare. You don’t need to leave your current host to use them — they sit “in front” of your website and can speed it up in various ways. Every paid plan, starting at $20/month, includes HTTPS support. I haven’t used them myself, so I can’t vouch for them, but they have an excellent reputation.
Fortunately, pretty much every major service with embed code has an HTTPS version, and most (including Google Analytics and Typekit) handle it automatically. For others, you’ll need to figure it out on a case by case basis.
Don’t forget to back up your SSL certificate, and its encrypted private key. I put them in a private git repository, and included a brief text file describing every other file, and the process or command that created it.
You should also back up your authentication certificate that you use to log in to StartSSL. StartSSL’s FAQ has instructions — it’s a .p12 file containing a cert + key that you export from your browser.