Thanks Jocko :thumbup
(last update on 08/05/2021)Below is a step by step tutorial of how to host a Wordpress (or any website) on NAS with
fvdw-sl firmware version 18-2.
I'll add the next steps (Wordpress installation, config, access) later on, when I'll do it on my own 5big2 NAS (with Jocko/admins' help - thanks :) )Table of Contents:1 - HOW TO RUN A WEBSITE (which doesn't need MySQL)2 - HOW TO INSTALL AND ACTIVATE MySQL3 - HOW TO INSTALL AND RUN WORDPRESS (version 5.7.1)4 - HOW TO INSTALL phpMyAdmin5 - HOW TO ... (to be continued)THINGS TO REMEMBER & TROUBLESHOOTING (at the end of this post)1 - HOW TO RUN A WEBSITE (which doesn't need MySQL) (
based on topic from: http://plugout.net/viewtopic.php?f=4&t=1578&p=11813&hilit=symlink+webserver#p11813)
First of all, if a website doesn't require to use a database (SQL), which mean if the website is fully working just by simply using HTML/PHP/CSS, then it should work without any other software installation.
How to check it? The best will be in practice:
What you need:
- NAS with the newest firmware (
in April 2021 it is: fvdw-sl firmware version 18-2)
- WinSCP (
or similar software which support SSH/SCP protocols)
- Files of your website
1.1 In folder '
fvdw' of your NAS create a subfolder named: '
myweb' (
the name can be different, but remember to change the 'myweb' to 'your one' everywhere in this manual)
1.2 Run WinSCP (It uses SSH - Secure Shell Protocol) and connect your PC with NAS:
- File protocol: SCP
- Host name: 'my NAS IP' (for ex: 192.168.1.20) (the IP can be checked by fvdw-sl-assistant.exe, when the NAS is ON)
- Port number: 22 (or your custom SSH port)
- User name: root
- Password: giveit2me (or your custom root password)
1.3 Open terminal from WinSCP bar menu:
Commands -
Open Terminal (not "Open in PuTTY")1.4 In the 'Enter command' type: '
ln -s /direct-usb/fvdw/myweb /usr/htdocs/myweb', and accept it by clicking: '
Execute' button. (
It will create a symlink for your website)
Done! The relevant URL would be
http://mynasmane/myweb/yourdefaultpage.html or
http://mynasmane/myweb if the default page is home.php
1.5 (
Optional for a basic website, necessary for a Wordpress!). Create a new file '.htaccess' in the folder '
myweb' with the content: '
DirectoryIndex index.php index.html'.
(the .htaccess file is needed for Wordpress or some other php websites to work properly)REMEMBER - At each firmware upgrade the symlink (
point 1.4) need to be restored (
because a new firmware may delete user's symlinks)
(
Another, more advanced solution for hosting a website, is to create a virtual host, explained at: http://plugout.net/viewtopic.php?p=11813#p11813)
If your website need MySQL, then go to the point 2:
2 - HOW TO INSTALL AND ACTIVATE MySQLWhat you need:
- NAS with the newest firmware (
in April 2021 it is: fvdw-sl firmware version 18-2)
- WinSCP (
or similar software which support SSH/SCP protocols)
- MySQL zip file (
see below) + mysql.so file
2.1 Download MySQL zip file:
mysql5137-26may12.zip from plugins at:
http://plugout.net/viewtopic.php?f=15&t=1324 and unzip it (unzipped file name is: 'mysql.tar') to any folder on your PC.
2.2 Run WinSCP (It uses SSH - Secure Shell Protocol) and connect your PC with NAS:
- File protocol: SCP
- Host name: 'my NAS IP' (for ex: 192.168.1.20) (the IP can be checked by fvdw-sl-assistant.exe, when the NAS is ON)
- Port number: 22 (or your custom SSH port)
- User name: root
- Password: giveit2me (or your custom root password)
2.3 Go to
/direct-usb/fvdw/addons folder and copy there the unzipped '
mysql.tar' file.
2.4 Open terminal from WinSCP bar menu:
Commands -
Open Terminal (not "Open in PuTTY")2.5 In the 'Enter command' type: '
tar -xvf /direct-usb/fvdw/addons/mysql.tar -C /direct-usb/fvdw/addons' and accept it by clicking: '
Execute' button. MySQL will be unpacked.
2.6 Go back to the
root directory (
by typing: 'cd /' in the terminal. Be sure that the Current directory shows: '/' location)
2.7 Now in the terminal ('
Enter command') type: '
mysql_install_db -u root' and accept it by clicking: '
Execute' button. MySQL will be initialized (ready for use). (
don't close the console/terminal window yet if you like to start the MySQL)
2.8 To start MySQL in background, in the 'Enter command' of the terminal type: '
/usr/local/libexec/mysqld --user=root &' and click: '
Execute'. When it's finish, close the console/terminal window.
2.9 Download the attached (at the end of this post
available for donors) tarball: '
fvdw-sl-18-2-extensions-bz2-mysql-mysqli-zip-php-5-6-6.tgz', and save it in the '
fvdw' folder.
2.10 Open Terminal in the WinSCP (Shift+Ctrl+T) and uncompress the tarball by typing in 'Enter command': '
tar -xf /direct-usb/fvdw/fvdw-sl-18-2-extensions-bz2-mysql-mysqli-zip-php-5-6-6.tgz -C / ' and accept it by clicking the '
Execute' button, and close the terminal window.
2.11 Go back to the: '
root/etc' folder in the WinSCP software, and Edit the '
php.ini' file (
select the 'php.ini' file and click 'Edit' from menu or just press F4 when selected). Then find the line with: '
extension=openssl.so' and insert in the next line the command: '
extension=mysql.so'. Save the file, and close the editor.
2.12 Open Terminal in the WinSCP (Shift+Ctrl+T), and perform a graceful restart of Apache web server, by typing in the 'Enter command': '
/usr/bin/httpd -f httpd.conf -d /etc -k graceful', and accept it by clicking the '
Execute' button. Don't close the terminal yet.
2.13 In the WinSCP terminal 'Enter command': '
/usr/local/bin/mysqladmin -u root' (
the 'root' is the user name for MySQL admin) & hit '
Execute', and again in the terminal set the password for the MySQL admin by typing: '
mysqladmin -u root password your_password' (
where 'your_password' can be any password you like. Just save it somewhere as your admin password for MySQL)
Note! To check if MySQL works, and to find what is the default SQL socket, login to your NAS fvdw-sl webpage (
http://yournasname), and in the System Management/System Information click: 'PHP and Apache status' tab, and scroll down to find if '
mysql'
and 'mysqli' tablestable exists, and what is the '
mysql.default_socket' name (
usually: '/tmp/mysql.sock')
The SQL is ready for databases. An extra info and manual about MySQL is available at:
https://www.php.net/manual/en/book.mysql.php3 - HOW TO INSTALL AND RUN WORDPRESS without phpMyAdminWhat you need:
- NAS with the newest firmware (in April 2021 it is: fvdw-sl firmware version 18-2)
- Already installed and run in background MySQL with 'mysql.so' extension (see the steps 2.1 -2.13) (be sure that the SQL socket exist in '
/tmp' folder (
/tmp/mysql.sock). If not, that may mean that your SQL is not running in background (
check the TROUBLESHOOTING at the end of this post)
- Wordpress installer (
download wordpress-5.7.1.tar.gz archive for a linux OS, version 5.7.1 (
or later) from:
https://wordpress.org/download/releases/)
- Own knowledge of how to create databases in MySQL, and how to manage privileges for the databases (
If you don't have the knowledge, go firstly to the point 4 - How to install phpMyAdmin)
3.1 After downloading the latest Wordpress version installer, store it in /direct-usb/fvdw/myweb, open a Terminal in the WinSCP (Shift+Ctrl+T) and uncompress the tarball by typing in 'Enter command': 'tar -xf /direct-usb/fvdw/myweb/wordpress-5.7.1.tar.gz -C /direct-usb/fvdw/myweb ', accept it by clicking the 'Execute' button, and close the terminal window. You should see a new subfolder 'wordpress' in myweb
3.2 Move WordPress files at the root level of myweb folder, open a Terminal in the WinSCP (Shift+Ctrl+T) and in 'Enter command': 'mv /direct-usb/fvdw/myweb/wordpress/* /direct-usb/fvdw/myweb ' and accept it by clicking the 'Execute' button, and close the terminal window. 'WordPress' folder in myweb should be now empty (of course you have first to refresh directory content (F5)
3.3 Delete WordPress folder and the tarball, do a right click on them and select "Delete" action
3.4 A small change need to be done on Wordpress files, because the new Wordpress requirement for PHP version is higher than the latest PHP version used in the fvdw-sl firmware version 18-2.
In the 'wp-includes' folder, locate the 'version.php' file. Edit the file in Notepad (
recommended: notepad++) by replacing line: '
$required_php_version = '5.6.20';' by '
$required_php_version = '5.6.6';' and save the changes.
3.5 Set the group on WordPress files (currently unset, groupid: 65534), open a Terminal in the WinSCP (Shift+Ctrl+T) and type in 'Enter command': 'chgrp -R nobody /direct-usb/fvdw/myweb ', accept it by clicking the 'Execute' button, and close the terminal window3.5 To be sure that the Worpress files, folders and subfolders have correct permissions (644 on files and 755 on folders), and to change the 'owner' for 'nobody', use the commands in WinSCP terminal:
type: 'chmod -R 644 /direct-usb/fvdw/myweb', 'Execute', then type: 'chmod -R a+X /direct-usb/fvdw/myweb', 'Execute', then type: 'chown -R nobody:nobody /direct-usb/fvdw/myweb', 'Execute', then type: 'chmod 440 /direct-usb/fvdw/myweb/wp-config.php', 'Execute' (the last one use a special 440 permission for the wp-config.php file). Be careful! It is a character sensitive (capital/not capital) command! The best is to copy-paste the commands.3.6 In the address bar of your browser type:
http://YourNASname/myweb/wp-admin/setup-config.php and hit '
Enter' (
check the 'YourNASname' by using the fvdw-sl-assistant.exe. You can as well use there an IP of your NAS instead of the NAS name)
3.7 You will see a
welcome screen with some basic information. Now you can start the Wordpress wizard configuration by pressing the 'Let's go!' button on the screen...
... but if you have no idea about the database settings, then I suggest to install phpMyAdmin to easily manage the SQL databases. Go to point 4:
4 - HOW TO INSTALL phpMyAdminto be continued...THINGS TO REMEMBER & TROUBLESHOOTING:- To create a symlink for website type in WinSCP terminal: 'ln -s /direct-usb/fvdw/myweb /usr/htdocs/myweb', where: 'myweb' is location of your website files.
- REMEMBER - At each firmware upgrade the symlink (point 1.4) need to be restored (because a new firmware may delete user's symlinks)
- Always use a command line (terminal in WinSCP) for unpacking a '.tar' files!!! For example: 'tar -xvf /direct-usb/fvdw/addons/mysql.tar -C /direct-usb/fvdw/addons'. The command line command line method keeps privileges of the files and folders. (Standard 'unpacking' in Windows don't keep the privileges).
- If 'localhost' or your 'mynasname' doesn't work, try '127.0.0.1' instead (some web browsers are trying to force a 'search' function instead of go to our local website)
- If you see an error like: 'Cannot log in to the MySQL server ... mysqli_real_connect(): (HY000/2002) ...' then try the solution from: viewtopic.php?p=35568#p35568
- No 'my.cnf' file anywhere on NAS. 'Mysqld' uses default values, and because of that the 'my.cnf' file it does not exist - it is not necessary. If you want to change some values then you may create it in /usr/local/etc.
- to stop all MySQL daemon processes, you can use the command in WinSCP terminal: 'killall mysqld'
You do not have the required permissions to view the files attached to this post.