Successfully install WordPress on Synology NAS (part 3)

Install WordPress on Synology NAS part 3 focuses on the WordPress.org solution. Its use is unlimited, but it is more complex to install. First, we install all packages and files on your NAS. Next, we configure the components to work together and achieve your desired goal.

wordpress.org, home page

Install WordPress on Synology NAS (part 3)

This is part 3 in a series of 4 about hosting WordPress on Synology NAS. The four parts each cover a different area of the topic.

Overview

The installation and configuration include several steps that I briefly highlight below. Further on in this post, I discuss them in more detail. This post was made with a Synology NAS running DSM 6.2.4 and later extended for DSM 7.0.1.

Installation

Instead of using WordPress from Synology, you install WordPress from a download at WordPress.org. The advantage is that you have full control over the version of WordPress you use, both from the start and during the lifetime of your website.

Because you do not install the WordPress package from Synology, you manually install the dependencies that WordPress relies on. You install them by using the packages in Package Center.

synology, package center, installed packages, dsm6, install wordpress on synology

For a quick overview, you install these packages (as of DSM 6.2.4 and 7.0.1):

  • PHP 7.3 and 7.4
  • Web Station
  • Apache HTTP Server 2.4
  • MariaDB 10
  • phpMyAdmin
  • Text Editor
  • WordPress (download from WordPress.org)
  • copy WordPress files from computer to NAS

The phpMyAdmin package uses PHP 7.3. For your WordPress site, I suggest you use the newer PHP 7.4. Note that these version numbers may change at a later date as Synology constantly updates the software.

Configuration

The configuration after the initial installation of packages is obviously more complex than the WordPress from Synology route. The following list briefly outlines the steps in the process:

  • configure Web Station
  • configure PHP extensions
  • change WordPress sample configuration
  • create WordPress database and user
  • redirect traffic for domain name
  • install SSL certificate
  • create virtual host
  • configure SSL certificate for virtual host
  • set web folder permissions
  • set WordPress folder permissions
  • WordPress 5-minutes installation

During the MariaDB 10 installation, you create a password for the database root account in MariaDB. You need the root account to create a WordPress database user later on.

Last, you run the WordPress installer. During this process, you provide the site name and create an administrative user account for the website.

Okay, let’s get started.

Installing WordPress from WordPress.org

In this setup, you will see all steps involved in a custom setup. It is very similar to what Synology has envisioned it, with several extra steps. The result is a WordPress website with your own domain that you access externally from the internet.

If you have reserved a specific volume for WordPress on your NAS, you can install the packages on that volume.

Install PHP 7.3 and 7.4

WordPress is a PHP application, and therefore you need to install a version of PHP. From Package Center, install both the PHP 7.3 and PHP 7.4 packages. Note that WordPress from Synology uses PHP 7.3, but we will use the newer PHP 7.4. However, phpMyAdmin from Synology still uses PHP 7.3.

synology, package center, php 7.4, dsm6

After installation, you won’t find any traces of it in DSM, not an application in the main menu, a folder, or else.

We configure the PHP 7.4 extensions later in Web Station. Here you find the PHP 7 datasheet.

Install Web Station

From Package Center, install the Web Station package. This package installs the Web Station application in the main menu. It also creates the shared folder /web with a subfolder /web/web_images and the index.html file. See the contents of this file for both DSM 6 and DSM 7 below.

synology, web station, index.html, dsm6
synology, web station, index.html, dsm7

The Web Station package turns your NAS into a web server. To check if Web Station works, open a separate window in your browser. Type in the address bar (without quotes) “ip_address_of_your_nas” or “server_name.local”. In both instances, you should see a blueish screen with a globe. This is the index.html file.

Here you find the Web Station datasheet.

Note that before you installed Web Station, typing the IP address or server_name.local in your browser resulted in the DSM login screen. The port number (default 5000 or 5001) was added automatically.

Now you have to add it yourself to get the DSM login screen. If you omit the port number, you get the index.html screen from Web Station.

Install Apache HTTP Server 2.4

WordPress needs an HTTP server, and for WordPress from WordPress.org, we use Apache HTTP Server 2.4.
Like with the PHP package, after installation, you won’t find any traces of it in DSM desktop, not an application in the main menu, a folder, or else.

synology, package center, apache http server 2.4, dsm6

We configure Apache HTTP Server 2.4. later for a virtual host in Web Station. Here you find the Apache HTTP Server 2 datasheet.

Install MariaDB 10

WordPress needs an SQL-type database, and MariaDB is the tool for this purpose. In Package Center, look up MariaDB 10.

synology, package center, mariadb 10, dsm6

As soon as MariaDB 10 is installed, it asks you for a password. This is the password of the root account of the database.  You will later use it when you let WordPress create a database and a user for itself.

Create a strong and unique password of at least 10 characters, mixed case, numeric characters, and special characters. Store it in a safe location. Please copy and paste it into the screen. This avoids typos. You will need it again in a few minutes.

synology, mariadb 10, set up, password, dsm6

Leave the port number at 3307 (DSM 6) or 3306 (DSM 7).

After the installation, you find the MariaDB 10 application in the main menu. It allows you to reset the root password and the database. Normally, you do not need to use this application.

Here you find the MariaDB 10 datasheet.

Install phpMyAdmin

In this scenario, installing phpMyAdmin is a mandatory step because you will use it to create the database user for WordPress. This PHP-based web tool lets you manage the database in MariaDB 10.

Open Package Center and install the phpMyAdmin package. This package depends on Web Station and PHP 7.3. Both are already installed if you followed this guide. Otherwise, your NAS installs them along with the phpMyAdmin package.

synology, package center, phpmyadmin, dsm6

After installation, you find an application in the main menu and files in the /web/phpMyAdmin folder. Click on the phpMyAdmin application in the main menu to open it in a separate browser window. Log in with the root account and password of the database. You created this password during the MariaDB 10 installation.

Install Text Editor

This is an optional step but one I recommend. The Text Editor is a plain text editor that you can use to edit configuration files for WordPress. If you have another editor on your computer that you prefer, skip this step.

synology, text editor, dsm6

In Package Center, install the Text Editor package.

Tip: the easiest way to use this editor is by right-clicking on a file to edit and choose Open with Text Editor.

Download from WordPress.org

You download the software from the internet because you choose to go all-in with WordPress on your NAS with the WordPress.org setup.

wordpress.org, home page

Download a recent version from the WordPress.org website to your computer. Why do I say recent and not the latest version? I have two reasons for that. First, the plugins or theme you plan to use might not yet be updated to be compatible with the latest WordPress release. Second, I always do an update when I build a new WordPress site. This is a good test for whether the permissions are set correctly.

Note that the download is a ZIP file, for example, wordpress-5.8.zip. Expand the ZIP file on your computer. You get a wordpress folder with approximately 19 items, including 3 folders.

macOS, finder, downloads, wordpress

And by the way, WordPress.org has its counterpart WordPress.com. The latter is a hosting service based on WordPress and run by Automattic. WordPress.org on the other hand is an open-source sibling for self-hosted installations.

Copy WordPress files

In this step, you copy the WordPress files and folders from your computer to your NAS. Note that uploading via File Station is quite slow. The transfer is much faster if you make a connection from your computer to the shared folder. Connect with an administrative user account from your NAS.

In File Station, select the folder /web. Click on the Create button > Create folder. In the pop-up dialog, enter the folder name.

synology, file station, create folder, dsm6

Give the folder a name that is unique to the website you create. Please do not call it /web/wordpress, as this is reserved for the Synology WordPress package. It is also non-descriptive.

Name your WordPress folder /web/wpaa for a website about All Animals or /web/wphc for a site about Home Cooking. Use your imagination as long it makes sense to you. In this example, I use /web/wpsd, which stands for WordPress Synologo Demonstration. I will use synodemo.com as my domain name.

Also, note to use lowercase characters in the folder name. Please don’t make it too fancy. Keep it basic, with alphanumerical characters only and without spaces.

Note: the reason for this unique folder name is that you can potentially create another (WordPress) website on your NAS in its own unique folder.

Configure WordPress from WordPress.org

After installation follows configuration. In the previous steps, you installed all applications and files on your NAS. Now, it is time to connect the dots and make it work.

Configure Web Station (DSM 6)

I start with the configuration of Web Station in DSM 6. Next, I discuss Web Station in DSM 7. Please read the part that applies to your setup.

Open Web Station from the main menu of your DSM 6 desktop. In the sidebar, select Status and check the status is:

synology, web station, status, dsm6

Your status should look like this:

  • Default server status: Normal
  • Personal website status: Disabled
  • Virtual Host status: — or Normal

Since there is probably no virtual host yet, there is no status information, and a double dash (–) is displayed.

In the sidebar, select General Settings and check the settings:

  • HTTP back-end server (Apache HTTP Server 2.4)
  • PHP: Default Profile (PHP 7.4)

Note that the general settings do not apply since we will create a virtual host for each WordPress instance that we host on Web Station.

synology, web station, php settings, dsm6

In the sidebar, select PHP Settings and check the settings:

  • Default Profile (PHP 7.3)
  • Default Profile (PHP 7.4)

Before we continue with WordPress installation, we prepare the Default Profile (PHP 7.4) with some extensions.

Configure Web Station (DSM 7)

Open Web Station from the main menu of your DSM 7 desktop. In the sidebar, select Status and check the status is:

synology, web station, status, dsm7

Your status should look like this:

  • Default server status: Normal
  • Personal website status: Disabled
  • Web service portal status: Normal

Notice the Back-end Packages and Service Packages sections with packages that you installed earlier.

synology, web station, script language settings, dsm7

In the sidebar, select Script Language Settings. Notice the Customized Profile section, which contains:

  • Default Profile – PHP 7.4
  • Default Profile – PHP 7.3

Before we continue with WordPress installation, we prepare the Default Profile – PHP 7.4 with some extensions.

Below the Customized Profile, you find the Packaged-based Profile section. Notice that for phpMyAdmin there is a dedicated PHP 7.3 profile.

Configure PHP extensions (DSM 6)

In Web StationPHP Settings page, select the Default Profile (PHP 7.4) and click on the Edit button. In the Advanced Settings dialog, look up the Extension at the bottom.

synology, web station, php settings, advanced, dsm6

Enable the following extensions:

  • curl, exif, ftp, gd, gettext, iconv, imagick, mysqli, openssl, posix, soap, sockets, xmlrpc, zip

Close the dialog with the OK button. You may leave Web Station open as we will return here shortly.

Configure PHP extensions (DSM 7)

In Web StationScript Language Settings page, select the Default Profile – PHP 7.4 and click on the Edit button. In the Edit PHP Profile dialog, select the Extensions tab.

synology, web station, script language settings, extensions, dsm7

Enable the following extensions:

  • curl, exif, ftp, gd, gettext, iconv, imagick, mysqli, openssl, posix, soap, sockets, xmlrpc, zip

Close the dialog with the Save button. You may leave Web Station open as we will return here shortly.

Change wp-config-sample.php

The wp-config-sample.php will change into wp-config.php during the WordPress installation process. The sample file is a template. By adding some lines to the script before the WordPress installation, you ensure that your website will include this.

With the Text Editor application installed, go to /web/wpsd (or whatever your folder name is), and double-click on wp-config-sample.php.

synology, text editor, wp-config-sample.php, dsm6

To allow direct downloads of updates from the internet instead of using FTP, add the following lines at the end of wp-config-sample.php:

//**The next line allows direct downloads*/
define('FS_METHOD', 'direct');

Save the file and close the Synology Text Editor.

Create WordPress database and user

From your DSM desktop, open the main menu and fire up phpMyAdmin. Note that it opens in a separate browser window or tab.

synology, phpmyadmin, login

Login to the MariaDB 10 database with account name root and the password you created during the MariaDB installation.

Note that phpMyAdmin is a web application, and you can always open it from http://ip_address_nas/phpMyAdmin/index.php. You do not have to log in to DSM first.

synology, phpmyadmin, add user

Select New in the column left, and click on the User accounts tab at the top of the right pane. This opens the User accounts overview page.

Click on the Add user account link under the New label. This opens the Add user account page.

synology, phpmyadmin, add user

Fill in under Login Information:

  • User name
    • Use text field (from drop-down list)
      • fill in a name for the database user; I use wpsd like the /web/wpsd sub folder I created earlier to keep it easy and consistent
  • Host name
    • Local (from drop-down list)
      • localhost
  • Password
    • Use text field (from drop-down list)
      • Generate a password with the Generate button. This fills in the password fields. Copy and paste the password in a safe place. If you already have a password, you like to use, paste it in the Password field and Re-type field.

Fill in under Database for user account:

  • Create database with same name and grant all privileges > enable

Now scroll to the bottom of the page and click on the Go button.

synology, phpmyadmin, add user

Notice the confirmation in the main screen at the top – You have added a new user – and the database in the left column.

You just created the database and user account that WordPress uses to access the database. Note that you need to copy the user name and password into the WordPress installation in a minute.

Logout from phpMyAdmin from the column left, second icon, a door.

Redirect traffic for domain name

If you plan to create a website with your own domain name, you best set up DNS and port forwarding before starting the WordPress 5-minutes install. Once properly set up, WordPress will configure the domain name correctly internally.

  • At the provider of the domain name, direct the domain name to the external IP address of your internet router.
  • In your router, create port forwarding rules for ports TCP 80 and 443 to the same ports of your NAS.

Suppose you like to use the registered domain name but use your website only internally, set up a DNS server on your local network. You can install a DNS server on your Synology NAS.

Install SSL certificate

If you plan to create a website accessible from the internet, I strongly advise that you install an SSL certificate for the domain. To succeed, you must perform the actions from the previous steps where I discussed how to redirect traffic for a domain name.

To be able to request and install an SSL certificate from the internet, your NAS needs to be accessible from the internet during the enrollment process. Therefore, both ports 80 and 443 must be forwarded in your internet router to your NAS. Use the manual of your router or search the web for instructions related to your brand and model router.

Go to Control Panel > Security > Certificate tab. If you have not requested a certificate for your host, you can request it now.

synology, control panel, certificate, add

Click on the Add button. The Create certificate screen opens.

synology, control panel, certificate, add

In the Create certificate screen, choose to Add a new certificate. Click Next.

synology, control panel, certificate, add

In the next screen, choose to Get a certificate from Let’s Encrypt. Click Next.

synology, control panel, certificate, add

In the next screen, fill in a domain name and a valid email address. Click Apply.

synology, control panel, certificate

You now return to the Control Panel > Security > Certificate screen. Notice that the new certificate is added to the list. You will configure this certificate for a virtual host after the next step.

Create Virtual Host (DSM 6)

From your DSM 6 desktop, open Web Station. Select Virtual Host in the column left. In the pane at the right, click Create.

synology, web station, virtual host

In the Virtual Host screen, enter the following information.

  • Hostname
    • you hostname or domain that you registered and that you will use for your site; I use synodemo.com
  • Port
    • enable the 80/443 box (default)
  • Document root
    • browse to the folder you created earlier; I use /web/wpsd as I showed earlier in when creating those folders
  • HTTPS settings
    if you plan to use SSL and like to enforce it, enable HSTS; by enabling HTTP/2 you speed up https traffic
    • enable HSTS
    • enable HTTP/2
  • HTTP back-end server
    • Apache HTTP Server 2.4
  • PHP
    • Default Profile (PHP 7.4)

After filling in all the fields, you click OK. A message about permissions as below may appear.

synology, web station, virtual host

It asks to click OK, but there is no OK button. Click Yes.

synology, web station, virtual host

You now return to the Virtual Host tab in Web Station. Review the virtual host you just created on the right screen.

You can close Web Station as we are finished with its configurations.

Create Virtual Host (DSM 7)

From your DSM 7 desktop, open Web Station. Select Web Service Portal in the column left. In the pane at the right, click Create > Create service portal. This starts the Portal Creation Wizard. The Select a portal type dialog opens.

synology, web station, create virtual host, dsm7

Choose Virtual Host. The Set up a virtual host dialog opens.

synology, web station, create virtual host, dsm7

In the Set up a virtual host dialog, enter the following information.

  • Hostname
    • you hostname or domain that you registered and that you will use for your site; I use synodemo.com
  • Port
    • enable the 80/443 box (default)
  • Document root
    • browse to the folder you created earlier; I use /web/wpsd as I showed earlier in when creating those folders
  • HTTPS settings
    if you plan to use SSL and like to enforce it, enable HSTS
    • enable HSTS
  • HTTP back-end server
    • Apache HTTP Server 2.4
  • PHP
    • Default Profile ( PHP 7.4 )
  • Access control profile
    • Not configured (default)
  • Error page profile
    • Default error page profile (default)

After filling in all the fields, you click Create. A message about permissions as below may appear.

synology, web station, create virtual host, permissions, dsm7

Click the OK button.

synology, web station, virtual host, dsm7

You now return to the Web Service Portal tab in Web Station. Review the virtual host you just created on the right screen under Customized Portal.

You can close Web Station as we are finished with its configurations.

Configure SSL certificate for virtual host

If you installed an SSL certificate on your NAS for your domain, link it to the virtual host before you start the WordPress 5-minutes install.

Go to Control Panel > Security > Certificate tab. Click on the Configure button in DSM 6 or the Settings button in DSM 7. This will show you all services on your NAS, for which you can configure a certificate.

synology, control panel, certificate, configure

Select the service in the Services column at the left. This is the host or domain name for your site you just configured a virtual host for. In the Certificate column at the right, select the proper certificate from the drop-down list. Click OK to close the dialog.

You may close Control Panel.

Set web folder permissions

The default folder permissions of the /web folder are not correct for your WordPress and phpMyAdmin applications. You use File Station from your DSM desktop to correct this.

Before we dive into the details, please be aware that a subfolder can inherit permissions from a parent folder, or have its own permissions set independently from the parent folder.

In our setup, the /web shared folder is the parent folder. Both the /web/phpMyAdmin and /web/wpsd folders are subfolders to the /web folder. Only the /web/wpsd folder for WordPress inherits the permissions from its parent folder, the /web folder.

  • web (parent folder)
    • phpMyAdmin (subfolder, explicit permissions)
    • wpsd (subfolder for WordPress, inherited permissions)
synology, file station, shared folder, properties

Open File Station and browse to the /web shared folder. Right-click the folder and choose Properties. In the Edit shared folder web dialog, open the Permissions tab. Here you see the default permissions:

synology, file station, shared folder, permissions

Notice that there is an http (user) and an http (group). You can tell the difference from the icons where a single head is a user.

Select the http (user) at the top, and click the Edit button. The Permission Editor opens. Open the User or group drop-down list, where the http (user) is selected. Scroll and select System (group). Click OK.

synology, file station, permission editor

Review the result. It should be like this:

  • SYSTEM (group) – read
  • administrators (group) – read & write
  • http (group) – read

Because you change only the permissions for this folder, you do not enable the checkbox at the bottom Apply to this folder, sub-folders and files, and click OK. You have now set the proper permissions for the /web shared folder.

Set phpMyAdmin folder permissions

Next, select the /web/phpMyAdmin folder. Right-click the folder and choose Properties. In the Properties dialog, open the Permissions tab. Set the permissions as for the /web folder.

Start phpMyAdmin application and check all works properly.

Set WordPress folder permissions

Next, browse the /web/wpsd (or whatever your WordPress folder is called) folder. Right-click the folder and choose Properties. In the Properties dialog, open the Permissions tab.

synology, file station, explicit permission

Notice that the permissions are grey because they are inherited from their parent, the /web share folder. First, we make the permissions explicit. Click Advanced options > Make inherited permissions explicit.

Next, you should change the permissions in:

  • SYSTEM (group) – Custom
  • administrators – Full Control
  • http (group) – Custom
  • users (group) – Custom

The Custom permissions mentioned above are Read + Write but no Delete.

When you are done, set a checkmark in the box for Apply to this folder, sub-folders, and files. Next, click OK. Now the permissions from the /web/wpsd folder are inherited by all subfolders and files.

WordPress pre-install

Go to your browser and enter the name of the Virtual Host you just created. In my case, I type in the browser the address synodemo.com. You type in your domain name. Notice the padlock, which means that the certificate is correctly linked to the domain name.

wordpress, setup-config script

Because WordPress is in its uninstalled state, you are redirected to https://domain_name/wp-admin/setup-config.php. This starts the installation script. Click on the Let’s go! button.

wordpress, setup-config script

Start with connecting to the database.

  • Database Name
    the database name you created, like my example wpsd in my case
  • Username
    the user name you created, like my example wpsd in my case
  • Password
    the password for the database user that you created earlier
  • Database Host
    this is important; only localhost will not work; fill in:
    localhost:/run/mysqld/mysqld10.sock
  • Table Prefix
    for example same as database name, but with a underscore at the end, like: wpsd_ but every other combination of characters will do.

Click on the Submit button.

wordpress, setup-config script

If the connection to the database was successful, you get the All right, sparky! message. Click on Run the installation to continue with the actual installation of WordPress, the famous 5-minutes install.

Note for those that are interested, you just created the file wp-config.php. This is the main configuration file of your WordPress site. One of its main purposes is maintaining the connection to the database.

WordPress 5-minutes install

The actual WordPress installation asks you just a few things. Don’t worry, take your time, it is easy. After the pre-installation above, you are directed to https://domain_name/wp-admin/install.php.

In the Welcome screen, you are requested to fill in some information.

wordpress, installer, 5 minutes
  • Site Title
    WordPress uses this as the title of your site. It can be the business name, or the name of your sports club or hobby.
    Note that you can easily change this afterwards so no reason to sweat about it.
  • Username
    This is the first user that you create to log into WordPress. It will have administrator privileges and you will typically use it to set up your web site in WordPress. You are advised to create at least one regular account later for creating content.
    Tip: choose a name that is not obviously recognizable as administrator. Avoid everything with ‘admin’ in it.
  • Password
    This is the password of the user mentioned above. Again, create a strong and unique password, save it and paste it into the screen to avoid typos. Do not reuse passwords.
    Note: the generated password is strong and a good option.
  • Your Email
    Enter a valid email address for the user. WordPress sends notifications to this address.
  • Search engine visibility
    If you are building your website, you may not need search engines crawling your site. If you use your site internally, this setting does not affect it anyway.

That’s all. Click the Install WordPress button. WordPress will be busy for a few minutes. When finished, you get the Success! screen. Click on the Log In button.

synology, wordpress, installer, success, dsm6

You now get the login screen, that gives you access to the backend of your website.

synology, wordpress, login, dsm6

Instead of logging in, let’s have a look at the website! Click in the log-in screen on Back to <site name> or type in the browser http://domain_name/.

You should see your WordPress website with the Site Title you just filled in.

With the address https://domain_name/wp-login.php you get the login screen. Log in with the username and password you just made with the WordPress installer. You are now in the admin pages or Dashboard. Here you manage your website. You can log out from the top-right corner.

Check for updates

You can log in to your WordPress dashboard and go to the Updates in the left column. Most likely, a pre-installed plugin needs an update. Performing the update is a good test before you start designing your site and filling it with content.

Thanks

Paul Steunebrink / Storage Alchemist

2 thoughts on “Successfully install WordPress on Synology NAS (part 3)”

  1. Thanks, Paul, so much for the detailed explanation of setting up WordPress for Synology NAS. I was able to replicate your explanation and created my first Blog. As I faced a lot of troubles setting up WordPress using Synology NAS in-app store.

Leave a Comment

Your email address will not be published. Required fields are marked *