Setting up VVV v1 with SSL


Even taking into stupid mistakes, this was fairly straightforward. Here’s how I set up my VVV local sites with SSL so I’m not screwed when I accidentally update Chrome. (It happens.)

I used Set Up SSL Locally on VVV/Vagrant WordPress Site by Kellen Mace and Site specific self signed SSL certificates from the VVV Github repo – chances are that those are all you need. I’m using VVV v1 and I think the repo instructions are for VVV v2 but I’m not really sure.

The biggest frustration with this was having to reprovision because of typos I had made. Have a cup of tea ready and hope that something exciting is happening on Twitter. Nice exciting, like some sort of funny puppy antics where people are being clever, not bad exciting, like someone’s launched a missile and we’re all going to die. The answer to the question “Was this painful enough to make me upgrade to VVV v2?” is no, not yet. It’s like 4pm and I just want to be done.

Ok so here’s what I did. Again, I think if you just followed the instructions in Kellen Mace’s post, you’d be fine. It’s just that I started with the one in the repo then thought, hmmm, wait. I wrote a script for part and then gave up on the script for step 2 because I didn’t have all that many to do.

  1. Get a certificate and key from OpenSSL. I ended up writing a script for generating these. The script is in my vagrant-local directory and writes to the www/SITE/ssl where SITE is what you enter at the prompt. There’s a line to the script that adds the certificate to my Keychain. (I started out importing the certificate and then trusting it using the Keychain Access app but that was kind of tedious.)
  2. In vagrant-local/config/nginx-config/sites add the following to the end of the server{}bit. This says “Hey, use ssl! The certificate is here! The key is there!” – those are the paths on the virtual server to the certificate and key.
    # Add ssl certificate
    ssl on;
    ssl_certificate /srv/www/SITE/ssl/SITE.dev.cert;
    ssl_certificate_key /srv/www/SITE/ssl/SITE.dev.key;
  3. And now vagrant provision. It failed a few times and always because of typos, sigh, this is why I should have figured out something for step 2. But other than that, it was straightforward.

And now it’s done and dusted. That was not nearly as hard as I thought it would be.

 

Leave a Reply

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

By submitting this comment, you are agreeing to the use of Akismet which helps reduce spam. You can view Akismet’s privacy policy here. Your email, website and name are also stored on this site.