How to Host a WordPress Website on a Synology NAS!

Today we are going to look at how to host a WordPress website on a Synology NAS.

A lot of people would like to host a website, but the monthly costs associated with web hosting isn’t always ideal. While it’s a good idea to scale your website to match the daily traffic it receives, it’s sometimes easier to host the website out of your house in the beginning. This avoids monthly charges and allows you to run the site on a device that most people have running 24/7. To be clear, Synology NAS devices don’t have huge amounts of processing power, so it’s not the best idea to host a site with a lot of traffic on a Synology NAS. In future tutorials, we will look at how to use Cloudflare which can drastically reduce the traffic demands on your local NAS, speed up performance, and increase security.

As a fun fact, this site started by being hosted on a Synology NAS. As it grew, I scaled it up to match the demand and it’s now hosted in the cloud.

1. WordPress Synology NAS Package Install Instructions

1. Open Synology’s Package Center and install the WordPress package.

wordpress synology nas

2. You will be informed that WordPress will automatically install a few different packages. Select Yes. The packages will now download and install.

wordpress synology nas

3. Create a password for the MariaDB package that’s installed. After the password has been defined, select Apply to install the package.

wordpress synology nas

3. Create a password for the MariaDB package that’s installed. After the password has been defined, select Apply to install the package.

wordpress synology nas

5. WordPress will automatically configure a database user. Enter a password that will be used for the wordpress_user.

wordpress synology nas

6. Select Apply to install the WordPress package.

wordpress synology nas

7. The WordPress package is now installed!

2. Creating a DNS Record

This part isn’t difficult, but we have to do it for a somewhat tricky reason. When you install WordPress, it will automatically install using the hostname or IP address you’re currently accessing the website with. Since opening the website will use the IP address of your Synology NAS, we need to create a DNS record or a host record on your local system before installing WordPress. Either will work, we just need to ensure that we’re accessing our WordPress site using the domain name we will be using in later steps.

For example, my site’s name will be dev.wundertech.net, so I will create a host or DNS record for dev.wundertech.net to point to the local IP address of my Synology NAS. This is only temporary, and we will remove this in a later step.

Hosts File

If you’re not using a DNS Server, follow the instructions below to modify your hosts file.

Windows 10 Instructions

Mac OSX Instructions

Ubuntu Instructions

DNS Record

Creating a DNS record will be different depending on the DNS server that you have configured. I use Pi-Hole, so I will create a Local DNS Record for my dev.wundertech.net domain and point it to my Synology NAS’s IP address.

3. Installing WordPress - Synology NAS

1. Select Open to access WordPress.

wordpress synology nas2. You will be brought to the IP address of your Synology NAS in the URL window. Change the IP address to be the domain name we created in our last step.

3. Select your language and press Continue.

wordpress synology nas

4. Create a Site Title, Username, Password, then enter your email address and search engine visibility. When everything has been entered, select Install WordPress.

wordpress synology nas

5. When it’s finished installing, you will be able to Log In using the password you created.

wordpress synology nas

6. WordPress is now installed!

4. Virtual Host Creation

The WordPress package is now installed, a DNS record has been created, and we will now update our virtual host.

1. Install the Web Station package from Synology’s Package Center.

2. Open the Web Station package and select Virtual Host. Then select Create.

3. Enter the hostname, select the web/wordpress document root, and select Apache HTTP Server 2.2 and Default Profile for PHP. Enable HSTS/HTTP/2 if you’d like. Select OK.

 

4. If you receive a message asking if you’d like to automatically update permissions, select Yes.

5. The final setting that we need to change allows PHP to access MySQL. Select PHP Settings and on the default profile, select Edit.

6. Select the checkbox next to mysqli and select OK.

5. File Changes

Technically, you will be able to get to WordPress now, but if you try and access any specific posts, you will receive an error. The reason is that our Site Address has /wordpress in the URL. We can quickly change this from the WordPress admin settings.

1. Navigate to your domain and add /wp-admin to the end.

http://[DOMAIN_NAME]/wp-admin

2. Select Settings, then General. Remove /wordpress from the end of your URL and save.

 

6. Website Exposing & Setting up an SSL Certificate

The website will now be set up and configured. Keep in mind, this is a blank website so you’ll probably want to go ahead and customize it before you expose the website to the outside internet. However, at this point, you’re ready to expose the website.

It’s very important to note that you need to have your purchased domain name ready at this point with a DNS record created. I will not be going through this process as there are tons of different registrars where you can purchase domain names, but ensure that you created a CNAME DNS record pointing to your DDNS hostname or an A record pointing to your static external IP address.

1. Ensure that you port forward ports 80 and 443 on your router to the IP Address of your Synology NAS. Make sure you create two allow firewall rules for ports 80 and 443. If you aren’t using Synology’s Firewall, I highly suggest you set it up before opening ports 80 and 443. I created a tutorial on how you can set up Synology’s Firewall if you’re interested in learning how to use it.

2. After the firewall rules have been created and you’ve port forwarded 80/443, open the Control Panel, select Security, then Certificate.

3. Select Add, then Add a new certificate, and Get a certificate from Let’s Encrypt.

4. In the Domain Name section, type your domain name and then select Apply. It will take a few minutes to validate.

5. The final step is to select Configure and select the correct certificate next to your domain name.

6. Your website is now configured with an SSL certificate and is ready for external traffic!

7. Conclusion - WordPress Synology NAS

This tutorial was meant to guide you through the entire process of setting up and configuring a WordPress website on a Synology NAS. In future tutorials, we will look at utilizing Cloudflare to use some of the free benefits that they provide.

As always, if you have any questions, please leave them in the comments. Thank you for reading the tutorial!

This Post Has 50 Comments

  1. Have you thought about updating this document for DSM 7 beta? Second do you advocate manually updating pkgs above what is in Synology as of now?

    1. I certainly will once DSM 7 is out of Beta. I will probably be redoing a lot of these tutorials!

      I normally don’t upgrade the packages, but it’s up to you. You would have to look at the individual package and see if the update is stable, so handling it on a case by case basis is best!

  2. Thanks for the tutorial! I’m attempting to migrate a WordPress website from BlueHost to my Synology. Any tips for migrating?

    1. Do you know what tool you want to use to migrate the server? I’ve migrated before using the free plugin “UpdraftPlus” and I’ve had success. There are various ways to do it though, so I don’t want to say that’s the only way.

      Let me know if I can assist at all!

      1. Hello again, I’m getting stuck on my migration. I wonder, would you be willing to chat with me and give me some help sometime?

        1. Hello – yes, feel free to email me (you can use the “tutorial request” form at the top). I will do my best to assist through email!

  3. Hello, does such a tutorial exist for DSM 7? That would be of my interest. Can not launch for several days 🙁

    1. Unfortunately, Synology takes a long time updating the packages for new DSM versions (especially beta’s), so you might have to wait until it’s updated. Another option is to run WordPress in Docker, since you won’t run into that problem (and I think the Docker package was recently updated, but I could be wrong).

  4. I just tried to migrate my WP web site from my NAS to a hosting service. And I learned that this is impossible for my site as their share and affordable plans, I am not a business, have ridiculously low database and space limits. Like disk space is still an expensive entity.
    It looks like I will stay on my NAS or a new one if I can figure out what would be the best NAS hardware for such a project. It would still be cheaper than the dedicated plans offered to accommodate my HD space requirements.
    And, of course, there is also the security issue when mixing web and local access. I am not sure whether it is save to have both on the same server hardware although on different HDs.
    Any suggestions are welcome!

    1. It’s hard to say what you should and shouldn’t do as there are various things to take into consideration. First would be uptime. If your site must be up 100% of the time, hosting it from home can be a challenge. If you are fine with the occasional downtime from a power outage or internet outage, hosting it from home is fine.

      As far as which NAS is best, I wouldn’t worry too much about the processor. Under my “recommendations” tab, I have a few listed that I personally recommend and any of them will be fine. It’s more important to have a good caching plugin and a CDN (like Cloudflare), which will drastically increase security and performance.

      So overall, if website uptime is important but not 100% uptime important, hosting a site from home is a great option. I know this was a lot so let me know if you have any specific questions!

  5. I’m trying to set up WordPress on a DS220+ On an XFINITY modem with a IP that is DHCP. I’m using Google for my domain host and I’m doing the set up using an IPad (which is another story).

    I’ve followed several tutorials before I found yours which are the best by far, and have gotten myself tied into a knot too many variables being changed at the same time. Plus Google likes to do their own thing that weren’t covered in most tutorials.

    I am now at a point where http and www take me to different sites one the Web Station welcome screen the the other to my sites welcome page and I don’t think the SSL is working. Please look at my mess and give some pointers

    1. How do your host records look? Do you have an “@” and “www” A/CNAME record that point to your external IP address? Does web station point directly to the WordPress folder, or are you pointing it to the top level folder?

      Let me know and we can continue troubleshooting!

  6. Great post tnx & keep going with these wonderfull howto’s 🙂

    You only missing one thing. You must enable OpenSSL (webstation > php settings > edit profile > openssl).
    Otherwise you get a download error when you try to update the wordpress plugins.

    The error I’ll get was: Update Failed: Download failed. No working transports found

    1. Thanks a lot for sharing your findings!

  7. Thanks for the reply! I’ll give that a shot!

  8. I’m having challenges after the first few steps… I’ve installed WordPress without any issues, I’ve added the entry to the host file

    xxxxx.com

    I then load WordPress and change the IP address to my domain and I get a 500 internal server error.

    1. Can you confirm that it’s properly using the internal IP address? You can confirm that by running command “nslookup [your domain]”.

      Let me know and we can continue troubleshooting!

  9. Thank for the tutorial. I am able to get all of my ddns to work on the internet and web pages to work thru dream weaver, my problem is that my wife uses Word Press, I was able to install word press on my 1621xs+ and I am able to create web page however when I hit publish it finishes and when I go to the URL it give me an error that is 403 and processing error. When I look at the sub-directory there is no files there. I have gone to the setting and pointed to that sub directory. Even on web station I point the root directory to all the different sub directories and just can’t find the files. I hope this is not to confusing. Much appreciate any help

    1. Have you tried appending “/wordpress” to the end of the URL to see if it works? It sounds like it can’t find any of the files. If that is the case, you might have to move the files one level up.

  10. Awesome tutorial! My girlfriend is currently looking to host her wordpress site locally and luckily I found your video. I had a small inquiry, are there any special steps I need to take in order to move her existing wordpress to my Synology NAS. She has a way to back it up so I assume I pull her files and store them into the web folder, I just am not sure what the process would be like when signing in, since it looks like you are creating a site name, username, etc near the start of the video. Any help would be appreciated! Thanks again for making this guide 🙂

    1. Thanks for checking out the tutorial! There are tons of different ways to migrate a WordPress site. Most of them are messy, if I’m being honest, but they do work. My favorite way is by using a plugin called UpdraftPlus. It will allow you to take a backup of the site, install WordPress locally, and then restore it. Hopefully this helps!

  11. Great set of tutorials for the Synology NAS. I’m a newbie on WordPress and would like to work on building a website with Elementor on my 918+ and test it out before going out into the real world verses building it on a hosted site. What would be the best approach to doing this on my internal LAN where I could preview the pages as if they were ‘live’ on the www and take my time experimenting with various content, widgets and themes?
    Thanks again for all that you do.

    1. My suggestion would be to set it up as usual, just don’t open ports 80/443 on your router. Then, create a local DNS record or host record for the domain you will be using and the IP address of your Synology NAS. This will allow you to access it using the domain name, configure it, and “open it up to the world” when you’re ready.

      Thanks for checking out the tutorial!

  12. Hi!

    I did (n-times) as it is described. First – I can not update plugins: “Update Failed: Download failed. No working transports fopund.
    If I change WordPress Address (URL) to http://192.168.x.x (inner address) it works fine. Same: instalation of plugins is impossible too. Sem as above.

    Further: forms do not send mail if Site Address (URL) is set to outer address. If it is changed to inner one, mail works.

    Any ideas?

    Thanks
    –jernej

    1. That generally happens from a URL mismatch. Are both URL’s set as the domain name, or just the site address?

  13. Great tutorial. easy to follow. I’ve set up a virtual host as per the instructions. Visiting Domain/wordpress works fine. When I follow the directions for removing/wordpress then I’m thrown to the Synology Set up Web Station page. Any ideas?

    1. Thanks! when you say removing wordpress, what exactly do you mean?

  14. Hello.
    Thanks for the tutorial. But something is missing… I did it several times as described. Doesn’t work:

    (1) the plugins can not be ubdated nor installed any new ones: Update Failed: Download failed. No working transports found
    When WordPress Address (URL) is changed to http://192.168.x.x/wordpress it works well.

    (2) Forms can not send emails when Site Address (URL) is set to https://www.”domain.com” (or whatever domain is registered).
    error: Extension missing: openssl. When set to http://192.168.x.x/wordpress, works witout any problems, but site is not visible to the outside world.

    Any ideas?
    Thank you –jernej

  15. Hello I tried to install wordpress but I can’t reach it even with the normal ip in the network (192.168.x.x) it just gives a 500 error

    1. Hello! Can you confirm that everything is properly running on the NAS? When you try and connect to it, what port are you using?

  16. Hello, thanks for the tutorial.
    I followed it exactly (other than I am using a ddns through synology and no ssl) and it works great as long as I go to 192.168.x.x if I go to dooley.i234.me I get “error establishing a database connection” this is while going to install.php. please help

    1. At what point are you receiving that error? Do you create the DNS record first?

  17. Hello. First of all I want to congratulate you on your tutorials. They are really educational and didactic.
    I have followed the instructions step by step and everything works until I configure the virtual host in the web station.
    I get the error:
    “Error establishing a database connection”.
    if I delete the created virtual host everything works again.
    if I enter with the url “mydomain.xxx.xxxx / wordpress
    Could you help me please. It’s driving me crazy.
    Thanks for everything.

    1. Hello! Thanks so much for the kind words! When you say that it stops working, how are you trying to access it? Did you create the A/CNAME record and point it to your local domain?

  18. Thanks for answering. I will try to explain myself. I have a DDNS pointing to my public IP (xxx.synology.me) When I try to configure the virtual host with this synology domain, it is when an error establishing a database connection occurs.
    If I delete the virtual host and then I enter my website at the address xxx.synology.me/wordpress.
    It works again.
    But …. I don’t want is for the word “wordpress” to appear in the address. I hope you can help me
    Thanks again for all your work.

    1. Hello! I think I understand what’s happening.

      Few questions – when you create the virtual host, are you pointing to the web directory or the WordPress directory? Also, if you enter in the domain (without /wordpress) and the domain (with /wordpress), do either of them work?

  19. Hello.
    When I create the virtual host I point to the wordpress folder (web / wordpress). When I enter the domain without wordpress the error is the following.
    “Error establishing a database connection”
    When I enter the domain with wordpress the error is the following:
    “Internal Server Error
    The server encountered an internal error or misconfiguration and was unable to complete your request.
    Please contact the server administrator at [no address given] to inform them of the time this error occurred, and the actions you performed just before this error.
    More information about this error may be available in the server error log.
    Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request. ”

    If I enter the local IP address (192.168.1.xx / wordpress) of my Synology everything works perfectly.
    Thanks for your answers. I have followed everything indicated step by step and I cannot install through the virtual host. I really appreciate your help.

    1. Sorry for making you try a bunch of different things – it’s just hard to troubleshoot since I haven’t seen it before. One additional thing I was hoping that you could try:

      Can you select the web folder (instead of the wordpress folder), create the virtual host as usual and then try and access it? You will most likely have to use /wordpress when you navigate to it, but I suspect that it might work. If not, we are facing bigger issues here.

      Thanks!

  20. Hello again.
    I have tried to configure the virtual host pointing to the web folder and the errors are the same as I have mentioned before.
    Thanks

    1. Are you able to get anything working using the virtual host? Meaning even a basic webpage?

  21. Yes, I have tried the virtual host with basic static web pages and it works without any problem.

    1. I am unfortunately at a loss at this point. Without being able to tinker with it, it’s hard to say what can and can’t work and I apologize. I would say that you need to tinker with the location or the permissions since everything is working without the virtual host. I just feel bad having you try random stuff that I’d normally try in my troubleshooting steps, so I apologize 🙁

      1. Hi, I am having a similar problem to Emilio. I am describing here my problem in a simple way to see if you or somebody else can reproduce my error and can find a solution.

        I have installed:
        DSM 6.2.4-25556
        Apache2.2
        php7.3
        MariaDB10
        Wordpress 5.5.3-0158

        Just to simplify more the problem I did the following test.

        If in my navigator I search for ‘http://ip.address.synology/wordpress’ everything works fine. And when entering in the admin area ‘http://ip.address.synology/wordpress/wp-admin’ I see that the WordPress Address (URL) and Site Address (URL) are both ‘http://ip.address.synology/wordpress’.

        Then in WorkStation I create a Virtual Host port based:
        HTTP: 81
        Document root: web/wordpress
        HTTP back-end server: Apache 2.2
        PHP: PHP7.3

        And in PHP Settings I only have the Default Profile PHP7.3 where I ticked the MySQL box.

        However, if now I search in my navigator ‘http://ip.address.synology:81’ I get the infamous ‘Error establishing a database connection’.

        This problem appears only with WordPress since if I create a different virtual host where the root folder points to web/webpage1 (containing a simple index.html), I am able to see the webpage. I gave all the permissions to my user (I am admin) in the web folder and all its content, so webpage1 and wordpress folders should have same permissions.

        I am quite new in this world and I am not able to see if I am doing something wrong. Could you confirm that my logic is correct? If you could try to reproduce my error and see if this also happens for you that would be awesome.

        1. By any chance, when you installed WordPress, did you install it by using the local DNS record and hostname (meaning you navigated to it using the hostname that you wanted to use)? That step is done so that WordPress installs and the site addresses are properly listed. It’s not a huge deal if you didn’t, but you will have to look up how to change them, and then assuming you have it mapped either by local DNS record of A/CNAME record on your registrar, I would assume that it should work.

          I hope this helps!

  22. Hi, I finally found the solution.

    My setup is basically the same as you described:

    Install WordPress from package center and when you open it, replace in the URL the ip.address.synology by mydomain.com and finalise the setup procedure. (This is done under the URL mydomain.com/wordpress/wp-admin…).
    Then set up the virtual host in web station:
    Hostname: mydomain.com
    root: web/wordpress
    and in php-settings select mysqli.

    If now I navigate to mydomain.com I would get the “Error establishing database connection”.

    So the new thing I had to do was to modify /web/wordpress/wp-config.php with the following:

    1. Replace define( ‘DB_HOST’, ‘localhost’ ) by define( ‘DB_HOST’, ‘localhost:/run/mysqld/mysqld10.sock’ ). This is particular of MariaDB 10.

    2. Replace
    define(‘WP_SITEURL’, $pageURL.$alias);
    define(‘WP_HOME’, $pageURL.$alias);

    by

    define(‘WP_SITEURL’, ‘http://mydomain.com’);
    define(‘WP_HOME’, ‘http://mydomain.com’);

    So now when going to mydomain.com I correctly get the webpage and with mydomain.com/wp-admin I access the backend and here I can check that now both WordPress Address (URL) and Site Address (URL) point to http://mydomain.com

    This could probably fix the issue that Emilio was also facing.

    1. This is awesome, thanks so much for sharing! Very happy to hear you were able to get it working!

    2. Thanks a lot Cecilio ! What was suppose to take minutes to configure finally took me a day but now WordPress is working from both my LAN and WEB.

    3. @Cecilio !!!!!!!!

      Mate thanks heaps! I spend more than 3 days just to be able to figure out this problem, and went all over the web, checked every guide that I could fin in the first 20 pages of google searches, nothing worked.

      Long story short for others: If you are encountering that database connection error, it is simply because of Maria DB10 using that string you pasted above. I did not even needed to change the rest. As soon as I pressed save, my domain started working.

      Youre a legend, hope you have a good one !

    4. Thank you so much for this, Cecilio! That was the missing brick in the wall. Interesting that with some installations this is required and with others not.
      One thing that also cost me some time and research: The fields for “WordPress-Adress (URL)” and “Website-Adress (URL)” were grayed out in WordPress settings. These have to be edited in wp-config.php directly (as Cecilio described).

  23. Thanks Cecilio !

Leave a Reply

Close Menu