Installing WordPress from WordPress.org

Post Reply
Steve
Posts: 51
Joined: Sun Oct 01, 2017 3:08 pm

Installing WordPress from WordPress.org

Post by Steve » Sat Mar 31, 2018 4:27 pm

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 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 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
(1.36 KiB) Downloaded 36 times

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
If you are using MariaDB 10 the host will be

Code: Select all

localhost:/run/mysqld/mysqld10.sock
Enter the Table Prefix you want to use. If you have an existing WordPress installation, the prefix 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. 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 the web site and you wil lreceive a 404 error when accessing your website. 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 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 #) for the fastcgi line of php you are using. 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 may not need the RewriteBase.

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 /
#RewriteRule ^index\.php$ - [L]
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.

Post Reply