How to setup multi-domain SSL in Node.JS using letsencrypt-express/greenlock-express

Updated (22/June/2018): Support for Let’s Encrypt v2

I have updated the code snippet below to include the support for Let’s Encrypt v2 in the snippet below:

 

I wanted to set-up a multi-domain SSL certificate using LetsEncrypt for my app “Dead Simple Screen Sharing” because people complained about the long meeting URL, so I bought a short domain mnow.io and edited the code to generate short 6 digit meeting ids, so the new meeting URL became much cleaner e.g https://mnow.io/345686 instead of the original https://app.deadsimplescreensharing.com/meeting/bgasGca-1

But I needed a new SSL certificate for the domain mnow.io, and as this domain will also be pointed to the same server, I required a multi-domain SSL certificate.

I had already configured greenlock-express (letsencrypt-express is now called as greenlock-express) on my server so just had to make some changes in the configuration and add my domain, but simply adding the domain in the domains array didn’t work, so after some trial and error I finally figured it out.

Here is the final code snippet, that you can use, add this in your app.js or server.js:

 

In line 10 replace ‘domain1.com’ and ‘domain2.com’ with your own domains, if you have more than 2 domains you can add them in the array, if you have only one domain then you also keep just one single domain in the array.

In line 12 replace ‘[email protected]’ with your email address.

The code on line 19 to 23 is optional, you can add it if you want to redirect all your traffic to https, and if you skip it then both HTTP and HTTPS versions of your site will be live.

Let me know if you have any questions, concerns or suggestions in the comments.

 

How to Setup WordPress blog with static homepage (Updated for 2017)

In the blog post, I will guide you through the process of setting up a static homepage for your WordPress blog when using the default TwentySeventeen theme.

The process of setting up a static homepage for your blog is straightforward. follow the steps below to make it happen:

Step 1: Upload your static homepage

The first step will be to upload your static homepage into your site, to do this you’ll have to FTP or SFTP into your blog, you can find the information on how FTP into your blog from your hosting provider and you can use a program like FileZilla or Cyberduck to FTP into your blog.

After you connect to your blog via FTP/SFTP go to the themes folder of your WordPress installation, usually it is located at htdocs/wp-content/themes/<theme_name> as we are editing the default “twentyseventeen” theme in our case the theme_name will be twentyseventeen htdocs/wp-content/themes/twentyseventeen 

Then in this folder, there will be a file named front-page.php, rename that file to front-page-old.php, if we don’t rename this file then WordPress will server this page as the homepage,  so we have to change the name of the file from front-page.php to something else.

After you have renamed the file, create new file name page_home.php in that folder, and paste the following contents into that file:

After the ?> tag paste the html content of your homepage in this file and save the file.

Now go to the htdocs folder and upload all the other static HTML pages you want to upload and CSS files associated with your homepage.

Step 2: Updating Settings in WordPress

Login to your WordPress Admin panel, Go to Pages->Add New, and create a new page with title Homepage and from the Page Attributes section select the Template as “Static Front Page” as shown in the  image below, and save the page.

Then we will also need a page to show our blog posts, Go to Pages-Add New and create another page, with title Blog, and edit the permalink of the page to /blog.

Then go Settings->Reading and in the section where it says “Front page displays” select “A static page” and from the drop-down select “Homepage” as the front page and “Blog” as the Post page.

 

Step 3: That’s it!

Following the above simple steps, you can setup the static homepage, let me know if you have any questions in the comments.