Configure SSL /https · NAS server · Secure your NAS

SSL on your WordPress site hosted on your Synology

I finally managed to add a Let’s encrypt to the WordPress sites I have hosted on my Synology (a while ago, I just forgot to post about it) and this definitely requires a blog post so others can also make it work.

Oh! this will work with Dynamic IP’s 🙂

Prerequisites:

  1. Install WordPress on your Synology
  2. Open ports 433/80 on your router
  3. Configure DDNS if you dont have a fast IP
  4. Buy a domain name

Buy a domain name

To be able to add https to your website you need to own your domain name. I use Hover for all my domain names.

If you also want to register your domain at Hover, click on this link or the picture below for a 2$ discount, when you sign up an account with them. Disclosure: I get also $2 discount, thanks!! 🙂

Hover-Refer-a-Friend-Post-

Get a $2 discount if you purchase your domain with Hover

Point your domain name to your synology

As I mentioned in the prerequisites, you need to have DDNS configured if you dont have a fast IP.

Once you have that, you point your domain name to your synology on hover. Log in in Hover and:

  1. navigate to your domain name (in my case apiexplorer.net) and click on it
  2. Click on DNS
  3. Click on Add a record

add record hover

Now we are going to create a:

  1. CNAME record
  2. Hostname is @
  3. Target name is your DDNS name or your fast IP.
  4. and click add record

cname settings hover

This is what you should see when ready:

cname hover

Now we need to make changes on our synology.

Configure your Synology Virtual Host.

It is not enough to redirect your domain name to your synology, you need to tell what this domain name should map inside your synology. To do that, we will use a Virtual Host.

  1. Click on Main Menu
  2. Click on “Web Station”

web station

Now:

  1. Click on virtual host
  2. Click on create
  3. Enter your domain name: apiexplorer.net
  4. Click on 80/443 ports
  5. Browse to the folder that contains your website: Web/mywebsite
  6. Add your apache server
  7. and your php configuration
  8. and you are done!

virtual host

With this steps, your site will now work with your domain as http://apiexplorer.net, but we haven’t configured the SSL yet. Let’s do that.

Open ports 80/443

If you dont want https , it is enough if you open the 80 port only, but as you are reading this, I imagine you want to configure SSL and therefore you need to open also port 443.

Great!!! Big steps forward, but we are not home yet. We still need to create the SSL certificate and configure our website to request always https.

Create a SSL certificate with Let’s Encrypt

I already have a blog post on how to create lets encrypt certificates on your Synology, so follow this steps.

The only difference is that when you configure your certificate, you will see a new service(2) called your domain name and that is the one you need to map your new SSL certificate against.

configure ssl certificate.png

Phew!! Almost there…

The last step now is to tell your website to always redirect http to https and you do this like this:

Change your .htaccess

This is how my .htaccess looks like looks like to redirect http to https:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
</IfModule>

# END WordPress

and now if you go to your website……SUCCESS!!!

ssl secured website wordpress synoogy.png

How amazing is that???

Loooooove my synology, dont you too?

 

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.