Install WordPress from WordPress.org on Synology

steven
Posts: 133
Joined: Sun Oct 01, 2017 3:08 pm

Install WordPress from WordPress.org on Synology

Post by steven »

The Synology version of WordPress is automated and easy to install. However, security updates are not implemented on a timely basis which leaves your website vulnerable to attacks. While installing WordPress from WordPress.org is a bit more complicated, security updates can be installed when released. Before you begin you should have MariaDB, php, phpMyAdmin and web station installed on your Synology. Additionally php must be configured and you will need to setup a website.

Download WordPress from WordPress.org. You can extract this file in your Synology web folder if you DO NOT have an existing folder named wordpress in the web folder. If you already have a folder named wordpress, you will need to create another folder with a unique name inside the web folder for your new installation. You can name this folder whatever you like but it must be different from your existing WordPress folder name.

If you are NOT going to run multiple web sites, you can install these files in the web folder.
I would not recommend this method as adding another site will require numerous changes.


If you extracted the contents into a unique folder it will contain a sub-folder named wordpress. Move the contents of the wordpress sub-folder into the parent folder and then delete the empty wordpress folder. The folder should have the following content:

Image

Once the WordPress files are installed, create a database in MariaDB.

Login to phpMyAdmin using the username root and your MariaDB password.
When phpMyAdmin starts you will see a screen like the one below.

Image

Select the User accounts tab and the following screen appears. Select the Add user account option shown at the red arrow below and select Go.

Image

On the user account page enter the user name, host name and password.
The user name is the name you want to give WordPress to access the database.
In this example the database name will be the same as the username. WordPress uses a user name and a password to access the database.

Image

For the Host Name select local from the pull down menu.

Enter the password you want to use for your database and re-type to confirm. This is the password WordPress will use to access the database. It IS NOT the MariaDB password. You can select Generate to have phpMyAdmin create a password as well. Make sure you copy and paste or write down the password somewhere safe. You will need it to connect WordPress to the database.

Check the box Create database with same name and grant all privileges.

Image

You do not need to grant global privileges however privileges can be changed later if you want this user to access another database.

If you want to use SSL enable it on your Disk Station. Enabling SSL on the database may prevent WordPress from connecting to the database correctly.

When finished select the Go button at the lower right of the screen.

The WordPress.org version it does not allow connections for updates and downloads by default. To avoid using FTP, use a UTF-8 text editor such as Komodo IDE or NotePad++ and add the following code before the php closing tag ?> at the end of the wp-config-sample.php file. If you do not want to edit the sample config file, use the download link below and extract to your WordPress folder.

Code: Select all

//**The next line allows direct downloads*/
define('FS_METHOD', 'direct');
wp-config-sample.zip


Now you are ready to install WordPress. There a a few ways to install WordPress depending on what you have setup so far. You can use a URL or a local LAN address in your browser. Choose the method you prefer to start the WordPress installation.

If WordPress is installed in the web folder, enter your website URL (Universal Resource Locator).

Example URL if WordPress is installed a web sub-folder:

Code: Select all

http://your_domain_name/wordpress_folder_name
If you do not have a URL address setup you can use a LAN address instead.

Example URL to use a LAN address: (replace xxx.xxx.x.xx with your server LAN address)

Code: Select all

http://xxx.xxx.x.xx/wordpress_folder_name
When you connect, you will get the following information screen:

Image

Select the "Let's go!" button and the following screen appears:

Image

On this screen enter the database connection information.

Image

Enter the database name you created in MariaDB using phpMyAdmin.

Enter the database user name you created in MariaDB using phpMyAdmin. (The user name is the same as the database name)

Enter the database password you created in MariaDB using phpMyAdmin. (Hopefully one stronger than my example)

Enter the database host information.
If you are using MariaDB 5 the host will be

Code: Select all

localhost:/run/mysqld/mysqld.sock
If you are using MariaDB 10 the host will be

Code: Select all

localhost:/run/mysqld/mysqld10.sock
You do not need to change the Table Prefix unless you have an existing WordPress installation. If you do, the table prefixes must be different. You can use a combination of letters, numbers and underscores like wp1_ or wp2a_ or anything else, except symbols. Just make sure the table prefixes are different.

After you enter the information click the select button and the following screen should appear.
If you get an error go back and make sure you entered the information correctly.

Image

When the screen above appears click the "Run the installation" button.

Image

Enter your website information on this screen and click the "Install WordPress" button. When the installation completes the WordPress login setup screen appears. Enter the title for your website. Then enter the user name and password you you will use to login to WordPress. Finally enter your admin email address and then check the box if you want to discourage search engines.

If you setup WordPress using a local LAN address users will not be able to access your website. Additionally you should not create any pages or install plugins using the local address. Once you determine what your URL will be, login to WordPress and select settings from the dashboard. You will see a screen similar to the following:

Image

You will need to change the WordPress Address (URL) and the Site Address (URL), shown at the red arrows, so users can access your site from the internet. An example is shown below if you are not using a virtual host.

Image

If you are using a virtual host the WordPress Address (URL) and the Site Address (URL) will NOT require the folder in the URL as shown below:

Image

Make sure you type any changes accurately or you will not be able to access your web site and get a 404 error instead. If you make a mistake you cannot correct URLs using WordPress because you cannot connect. To fix these errors you will need to login to phpMyAdmin and edit the option table in your new WordPress database as shown below.

Image

If you created any pages or posts using the local LAN address you will need to search the tables and change the local LAN address. If you installed any plugins you should deactivate each plugin. Reinstall the plugin once the URL has been corrected.

If you are going run multiple websites from one IP address, try Synology's Virtual Host option in Web Station.

If you don't want to use a virtual host, you can create an index.php file in the root folder that loads WordPress. Use a UTF-8 editor like Komodo IDE, NotePad++ or WordPad to create the index.php file and place the following code in the file. If your folder has a name other than "wordpress" change the path to use your folder name.

Code: Select all

<?php
/**
 * Tells WordPress to load the WordPress theme and output it.
 *
 * @var bool
 */
define('WP_USE_THEMES', true);

/** Loads the WordPress Environment and Template */
require( dirname( __FILE__ ) . '/wordpress/wp-blog-header.php' );
Save this file in the web folder. When someone accesses your site this file will load WordPress. If you have WordPress installed in the wordpress folder, you can download an index file from the setup a website post and use the file. If you use a different folder name, you will need to edit the line require( dirname( __FILE__ ) . '/wordpress/wp-blog-header.php' ); and change wordpress to your folder name,

You should use Apache for the backend server with each program folder containing an .htaccess file. Wordpress creates a htaccess file when it installs. However the file may not load the fastcgi protocol or contain a rewrite base declaration if WordPress is loaded from a child of the web folder. Here is an example .htaccess file with fastcgi and a RewriteBase. Uncomment (remove the #) from the line for the php version you are using, if you want to use fastcgi. If your WordPress folder has a name other than "wordpress" change the RewriteBase line to use your folder name. If you are using a virtual host you do not need the RewriteBase line and can comment it out or delete it.

Code: Select all

# Synology PHP
AddHandler default-handler .htm .html .shtml
AddHandler php-fastcgi .php
AddType text/html .php
#Action php-fastcgi /php56-fpm-handler.fcgi
#Action php-fastcgi /php70-fpm-handler.fcgi
# Synology PHP

RewriteEngine On
RewriteBase /wordpress/

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
You can use NGINX instead of Apache but this is more complicated and requires creating or modifying system conf files.
You do not have the required permissions to view the files attached to this post.
naeseanaes
Posts: 2
Joined: Tue Feb 12, 2019 5:11 pm

Re: Installing WordPress from WordPress.org

Post by naeseanaes »

Thank you so much for writing this guide!

I've run into a problem though where I cannot install or update any new themes or plugins from the wp-admin console. Any idea how to fix this permissions issue? Thanks!! Sean
steven
Posts: 133
Joined: Sun Oct 01, 2017 3:08 pm

Re: Installing WordPress from WordPress.org

Post by steven »

If you're getting an error, what is the error code?

In the mean time, the Synology version updates automatically but the WordPress download version does not. To allow automatic updates add the code below before the last php closing tag ?> in wp-config.php.

Code: Select all

define('FS_METHOD', 'direct');
naeseanaes
Posts: 2
Joined: Tue Feb 12, 2019 5:11 pm

Re: Installing WordPress from WordPress.org

Post by naeseanaes »

Thanks for the quick reply, Steve. I made a couple changes and solved it. I changed the owner of the wordpress.org folder to by 'http' and I updated the permissions on the group to be Read/Write. For some reason the permissions were Read only.
steven
Posts: 133
Joined: Sun Oct 01, 2017 3:08 pm

Re: Installing WordPress from WordPress.org

Post by steven »

That’s great, glad to hear you solved the problem. One thing I’ve noticed is if you drag files from a zip, or copy files, to the NAS using windows, the folders or files may not inherit web folder permissions. However if you extract the zip files using File Station, permissions are inherited automatically.
Last edited by steven on Sat Jun 27, 2020 8:44 am, edited 1 time in total.
Reason: Clarified extract zip with File Station
sm3nse
Posts: 2
Joined: Sun Mar 31, 2019 4:27 pm

Re: Installing WordPress from WordPress.org

Post by sm3nse »

Hi.
I can't get this to work.
After the page where you fill in database connection details:
http://x.x.x.x/wordpress/wp-admin/setup-config.php?step=1
I just get a blank page:
http://x.x.x.x/wordpress/wp-admin/setup-config.php?step=2
Totally blank, no error codes or anything.
Changed owner and permissions with no result.
Any ideas?
steven
Posts: 133
Joined: Sun Oct 01, 2017 3:08 pm

Re: Installing WordPress from WordPress.org

Post by steven »

Check permissions on the WordPress folder using file station. Right click the folder and select properties then select the permission tab. User http should have read/write permissions. If permissions are incorrect select or create a http user, check the Apply to this foler, subfolder and files check box and give the http user read and write permissions.
sm3nse
Posts: 2
Joined: Sun Mar 31, 2019 4:27 pm

Re: Installing WordPress from WordPress.org

Post by sm3nse »

I had missed the PHP settings in web station... :oops:
My bad.
Up and running now. Thanks for your reply.
steven
Posts: 133
Joined: Sun Oct 01, 2017 3:08 pm

Re: Installing WordPress from WordPress.org

Post by steven »

Great, glad you have it running!
wobble
Posts: 13
Joined: Mon May 25, 2020 4:46 pm

Re: Install WordPress from WordPress.org on Synology

Post by wobble »

I've spent some days with your information open as a reference while I try to get to access my new wordpress site visible on the internet.

My registered domain through DDNS service from Dynu will reach the index.html default page in the Web directory "Web Station has been enabled. .. etc".

I cannot get it to show the Wordpress site - which I can view using the internal IP address of my server n.n.n.n/wordpress.

I've tried with virtual hosts and without.

It feels like I have spent weeks on this ;-( Any further clues welcome!