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:
- Install WordPress on your Synology
- Open ports 433/80 on your router
- Configure DDNS if you dont have a fast IP
- 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!! 🙂
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:
- navigate to your domain name (in my case apiexplorer.net) and click on it
- Click on DNS
- Click on Add a record
Now we are going to create a:
- CNAME record
- Hostname: write the domain name ex, (mydomain.com)
- Target name is your DDNS name or your fast IP.
- and click add record
This is what you should see when ready:
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.
- Click on Main Menu
- Click on “Web Station”
Now:
- Click on virtual host
- Click on create
- Enter your domain name: apiexplorer.net
- Click on 80/443 ports
- Browse to the folder that contains your website: Web/mywebsite
- Add your apache server
- and your php configuration
- and you are done!
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.
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!!!
How amazing is that???
Loooooove my synology, dont you too?
Hi, nice article!
I still face one big issue… I used syno packages to install wordpress. Everything is installed correclty, website is running but I can’t find my wordpress folder under the Web directory
Do you know how to manage this situation?
LikeLike