Running a WordPress website on your NAS includes maintenance. In the fourth and last part of this series you learn about backup, installing another WordPress instance, and how to suspend, reset or uninstall WordPress. At the end we touch the benefit of a local DNS server for your WordPress site.
Install WordPress on Synology NAS (part 4)
This is part 4 in a series of 4 about hosting WordPress on Synology NAS. The four parts each cover a different area of the topic.
- Part 1 – introduction to WordPress on your NAS
highlight the different scenarios and necessary preparations
- Part 2 – install WordPress from Synology
highlights the installation steps of this setup
- Part 3 – install WordPress from WordPress.org
highlights the installation steps of this setup
- Part 4 – WordPress maintenance (this post)
backup, second instance, suspend, reset and uninstall, internal DNS setup
- Install WordPress on Synology NAS (part 4)
- WordPress Backups
- Install a second WordPress instance
- Suspend WordPress
- Reset WordPress
- Uninstall WordPress
- DNS Server setup
Before you get wild with your website, take a moment to consider your WordPress backup. You have two options, the Server-side backup, and the Inside-WordPress backup. You can do either or both.
Since you host your website yourself, you can make a backup from the files and folders and the database that comprise your website.
The advantage of a server-side backup is that you can restore the website when it is completely broken, inaccessible, or removed. You can selectively restore a file or folder but only restore the entire database. If you have multiple databases for different websites, they are affected by the restore as well.
Only with a database export from phpMyAdmin, a MySQL database management tool, you import databases selectively. Here you find the phpMyAdmin datasheet.
You make a server-side backup with Hyper Backup on your NAS. Ensure that you add the /web folder with subfolders and the MariaDB 10 and Web Station applications to your backup task. The latter saves the configuration of these applications. Here you find the Hyper Backup datasheet.
When you restore an entire WordPress website removed from your NAS, there are a few issues to take care of.
Restore WordPress from Synology
Assume that you have the backup as mentioned above but removed the WordPress setup entirely. Just re-install the WordPress package from Package Center. This will install all dependencies, the other applications, and services that WordPress relies on. This installation includes the root and wordpress_user accounts in the database.
Do not perform the last step, the 5 minutes setup in WordPress. It is not harmful if you do, but it is unnecessary.
Now, restore the backup, particularly the /web/wordpress folder and the Web Station and MariaDB 10 application data. When the restore process finishes, your website is back again.
Restore WordPress.org setup
For a successful restore, make sure you install dependencies like Apache HTTP Server 2.4 and PHP 7.4. Note that both Web Station and MariaDB 10 are automatically restored when you restore the backup.
Now, restore the backup, particularly the /web folder and the Web Station and MariaDB 10 application data. When the restore process finishes, your website is back again. However, there may be a problem accessing it or logging in when you had an SSL certificate for the site. This is caused by the fact that the right certificate is not linked to the site.
To fix this, go to Control Panel > Security > Certificate tab. Click on the Configure button and re-establish the connection between the certificate and the service. The service represents the virtual host in Web Station. Now your website should run as before.
Next to or instead of the server-side backup, you can make backups from within WordPress, the Inside-WordPress backup. You install a plugin in WordPress from your admin pages for this backup, also known as the Dashboard. This backup will only backup that specific website. If you have multiple WordPress instances running, you install a plugin in each website’s admin pages and make a backup.
There are several good backup plugins, and UpdraftPlus is just an example. This is a popular backup plugin, and it let you save both the database and the files. The plugin is free with some paid options.
You can select which component you like to restore during a restore: database, themes, plugins, uploads, and other components. The selected component is restored entirely. For example, you restore the database. The entire database for that website is restored, but other databases on your NAS are not affected, like with the server-side backup.
The UpdraftPlus backup plugin can save the backup on your NAS in a dedicated folder between your WordPress folders or on a cloud service like Dropbox, OneDrive, or Google Drive. If you save it on your NAS, it would be wise also to do a server-side backup to another destination in case your NAS fails.
Install a second WordPress instance
In part 3 of this series, I already mentioned that you might install multiple instances of WordPress. This way, you create multiple WordPress websites for different domains on the same NAS.
Note that the WordPress from Synology installation, described in part 2, does not allow for a second instance.
Referring to the installation and configuration as outlined in part 3, you skip all package installations and head over to the steps for installation of the WordPress folder. Create another folder in the /web folder and copy the WordPress files from the WordPress download to that folder.
Next, continue with the entire configuration process, including setting permissions, creating a new user in the database, installing the SSL certificate, adding a virtual host, and up to the WordPress 5-minutes install.
The virtual host will determine which website is called upon based on the domain name. There is no need to configure other ports in either the internet router or your virtual host in Web Station.
You might want to (temporarily) suspend the operation of your WordPress website without affecting the entire setup of the database, files and folders, and all configurations. There are several ways to achieve this, depending on what you want to achieve and which kind of installation you have.
You can stop forwarding ports 80 and 443 on your router to your NAS. This suspends external access to your website(s), not internal access.
Note that this step affects other websites on your NAS and potentially other services that rely on the same ports, like updating SSL certificates.
Suspend WordPress from Synology
If you have a WordPress website set up with the WordPress package from Package Center, you can stop the service for that package. You can do this from Package Center. Please reference the WordPress datasheet for details.
This affects only the WordPress website, not any other websites you might have, like Joomla or PHP-based on your NAS.
Suspend WordPress.org installation
A WordPress.org installation is less easy to suspend. You can stop either the Apache HTTP Server 2.x or the MariaDB 10 service from Package Center. Please reference their respective datasheets for Apache or MariaDB.
Note that this affects other websites that are dependent on either of these services.
You have tested a WordPress installation, messed around with it, and would like to start again from scratch. This means you let the entire underlying infrastructure intact but only refresh what WordPress created.
As with suspending WordPress, I explain how to reset it for the Synology and WordPress.org setup.
Reset WordPress from Synology
This is a straightforward process at first glance, but there is a catch.
First, uninstall the WordPress package from Package Center. Please reference the WordPress datasheet. This also removes the database for that website but leaves the wordpress_user in the database. This is an important detail, as you will see in a minute.
Next, you install the WordPress package again from Package Center. You fill in the password of the root account, which you hopefully kept safely. Next, you fill in the password for the wordpress_user, and that fails.
The reason is that the wordpress_user’s password is reset during the uninstallation of the WordPress package. There are two workarounds.
- In the WordPress setup, create a new user account by changing the name to something different from the default wordpress_user
- Reset the password for wordpress_user in the database with phpMyAdmin; a daily task for a database administrator, but not for those who opted for ease of installation
- Re-install the MariaDB 10 package along with the WordPress package; this completely removes the entire database including the wordpress_user, making a fresh start.
Options 1 and 3 are by far the easiest, I think, but it all depends on your skill level.
Reset WordPress.org installation
Resetting the manually installed WordPress.org setup is, as you’d expected, a manual process. It actually involves two steps:
- remove the user and drop the database
- refresh the WordPress folder
Note that the order in which you execute these steps is irrelevant.
Remove user and database
Log in to phpMyAdmin. In the left column, select New.
In the main screen at the right, select the User accounts tab. Select the user to remove. In my case this is wpsd but your name is probably different.
Under Remove selected user accounts, you enable the option Drop the database that has the same names as the user. Click Go.
If the user and the database do not have the same name, you must drop the database separately. Continue in phpMyAdmin.
Select New at the top in the left column. In the main screen at the right, select the Databases tab. Check the database to remove or drop in SQL talk. Click on Drop, just below the list of databases. You get a pop-up (You are about to DESTROY a complete database!) and confirm with OK.
Next, create the database user again with the database described earlier under Create WordPress and user in part 3 of this series.
Refresh the WordPress folder
To refresh the WordPress files, go to the proper folder under the /web folder. For example, in part 3 of this series, I created /web/wpsd, but you can use your own name for the subfolder. Remove all files and folders in that folder but leave the folder intact.
Next, download the WordPress zip again from the WordPress.org download page, and unzip it on your computer. Next, copy the contents of the wordpress folder from the zip into the /web/wpsd folder (use your own subfolder) as described earlier in Copy WordPress files in part 3.
Do not forget to add two lines of text to the wp-config-sample.php file as described in Change wp-config-sample.php in part 3 of this series.
If you like to take things a step further and plan to remove WordPress and dependencies fully, uninstall the packages in the reverse order that you installed them. Some packages offer the option to remove their data. When you remove Web Station, consider removing the /web shared folder as well. You can use Control Panel > Shared Folder for that task.
Note that Hyper Backup backs up MariaDB 10 and Web Station applications and folders. Remove them from the backup task to prevent Hyper Backup from generating an error message.
Last but not least, remove port forwarding to your NAS from your router. Change the configuration of your DNS domain to reflect the new situation.
DNS Server setup
If you like to access your WordPress website with a domain name, you have to configure DNS. If you like a shortcut for connecting locally, you can set up a DNS server on your NAS.
Paul Steunebrink / Storage Alchemist