How to host a website on 5big Network2

How to host a website on 5big Network2

Postby lisek » Sun Apr 25, 2021 9:04 pm

Hi everyone,

I spent two days by reading many topics in here, but I couldn't find any info related to the 5big2 NAS.
So, is it possible to host a Wordpress website on this 5big2 NAS, and what need to be done to do it?

If so, I'm not sure if the PHP 5.6.6 is not to old now, and how about MySQL (how and where to install it, and which version?)

I pre-installed clean fvdw-sl firmware version 18-2 with the latest two patches. Disks are configured as RAID5.

Actually I'm confused because I can't find some folders noticed for other people like : '/direct-usb/fvdw' or '/share/1000/fvdw' or 'usr/htdocs'...
(of course I can manage files and subfolders inside of the 'fvdw' folder from windows. I just can't find it when I use fvsw-sl-console)

Maybe the answers are simple, but I'm not any expert of linux or a server user :)

Kind regards,
Rob
lisek
Donator VIP
Donator VIP
 
Posts: 20
Joined: Fri Feb 01, 2019 9:15 pm

Re: How to host a website on 5big Network2

Postby Jocko » Mon Apr 26, 2021 6:52 am

Hi

Yes should be able to install wordpress, it requires a php version greater than 5.2.4 and currently our fw uses version 5.6.6

You have to follow these two topics :
https://plugout.net/viewtopic.php?f=11&t=2301&hilit=wordpress
http://plugout.net/viewtopic.php?f=4&t=1578&p=11813&hilit=symlink+webserver#p11813
Some instructions can not be done on the user side but only from a root shell access (for example to create a symlink). The best way is to use winscp.

About direct-usb it is a symlink and can be see only from a root shell window. According to topic posted time, you may find some paths like /share/1000/fvdw or /direct-usb/fvdw. Indeed we create this symlink to target in all case the location where external usb shares are mounted and the technical shares like fvdw, tr-daemon, ... According with the nas state it may be /share/1000, /share/1001,... or /share/1100
Jocko
Site Admin - expert
 
Posts: 11367
Joined: Tue Apr 12, 2011 4:48 pm
Location: Orleans, France

Re: How to host a website on 5big Network2

Postby lisek » Mon Apr 26, 2021 9:43 pm

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 MySQL
3 - HOW TO INSTALL AND RUN WORDPRESS (version 5.7.1)
4 - HOW TO INSTALL phpMyAdmin
5 - 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 MySQL

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)
- 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.php

3 - HOW TO INSTALL AND RUN WORDPRESS without phpMyAdmin

What 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 window
3.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 phpMyAdmin
to 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.
Last edited by lisek on Sat May 08, 2021 8:43 pm, edited 9 times in total.
lisek
Donator VIP
Donator VIP
 
Posts: 20
Joined: Fri Feb 01, 2019 9:15 pm

Re: How to host a website on 5big Network2

Postby Jocko » Tue Apr 27, 2021 8:34 am

Hi

Thank you for your howto.
I made some suggestions in your post (mainly use the symlink /direct-usb which allows to tagert in all cases the share fvdw)
Jocko
Site Admin - expert
 
Posts: 11367
Joined: Tue Apr 12, 2011 4:48 pm
Location: Orleans, France

Re: How to host a website on 5big Network2

Postby lisek » Wed Apr 28, 2021 10:56 pm

I'm slowly going forward when I've got time, but there is a problem of the newer PHP/Wordpress version recommendations:
- Your server is running PHP version 5.6.6 but WordPress 5.7.1 requires at least 5.6.20 -

In general speaking, here is the official system requirements:
PHP version 5.6.20 or higher.
MySQL version 5.0 or higher.

Recommendations:

PHP version 7.4 or higher.
MySQL version 5.6 or higher.
The mod_rewrite Apache module.
HTTPS support.

Any chances for the newer PHP in the firmware?

And another question:
Is it possible to install phpMyAdmin on 5Big2?
lisek
Donator VIP
Donator VIP
 
Posts: 20
Joined: Fri Feb 01, 2019 9:15 pm

Re: How to host a website on 5big Network2

Postby Jocko » Thu Apr 29, 2021 8:47 am

Hi

Nope, if it works on 5.6.20 that means it works on the branch 5.6.x. There is no new feature or compatibility issue in 5.6.20 (see https://www.php.net/ChangeLog-5.php#5.6.20).
He wrote 5.6.20 because it is the latest subversion available from the branch 5.6.x

Upgrade php version is a huge works and there is a lot of compatibility issues between version 5.6 and 7.x. Our fw web-interface may run on version 7.x with few changes but currently several web-interface of some servers running on fw can not work with a version 7.x and then require to be patched (or need to rewritten!!!). So a big job if a patch is possible and a no way if their web-interface have to be rewritten (for example with tflux)
It is why we do not yet upgrade php.

So it is worth you tries wordpress with version 5.6.6
Jocko
Site Admin - expert
 
Posts: 11367
Joined: Tue Apr 12, 2011 4:48 pm
Location: Orleans, France

Re: How to host a website on 5big Network2

Postby Jocko » Thu Apr 29, 2021 3:29 pm

About phpMyAdmin, you can do it yourself

* install phpmyadmin files
- create a share, for example, phpmyadmin
- open winscp, and search where it is stored in /share/1xxx. (xxx maybe 000, 001, 002,... or 100, 101, 102, ...)
- then open a terminal window from /share/1xxx/phpmyadmin
- download the package from https://www.phpmyadmin.net/downloads/ (copy the wanted url for version 4.9.7 allowing to download a package with extension "tar.gz"), for example with the url "https://files.phpmyadmin.net/phpMyAdmin/4.9.7/phpMyAdmin-4.9.7-english.tar.gz") by entering the command
Code: Select all
wget https://files.phpmyadmin.net/phpMyAdmin/4.9.7/phpMyAdmin-4.9.7-english.tar.gz
- close the terminal window
- on the tarball file, make a right click and go to File custom commands => Untar/Gzip to uncompress the files. You should have now a new folder "phpMyAdmin-4.9.7-zzzz",
- open this subfolder
- do a new right click and create a new file '.htaccess' at the root to overwrite the current directive 'DirectoryIndex' set for our web server
- add the following line in the new .htaccess file:
Code: Select all
DirectoryIndex index.html index.php
- add a symlink in /usr/htdocs, so from a terminal window, enter the command
Code: Select all
ln -s /share/1xxx/phpmyadmin/phpMyAdmin-4.9.7-zzzz /usr/htdocs/phpmyadmin

- create the default tmp dir in phpMyAdmin-4.9.7-zzzz
Code: Select all
ls -s /rw_fs/tmp /share/1xxx/phpmyadmin/phpMyAdmin-4.9.7-zzzz/tmp


That's all on phpmyadmin side

* add the missing extensions (mysqli, bz2 and zip):
- download the tarball 'fvdw-sl-18-2-extensions-bz2-mysql-mysqli-zip-php-5-6-6.tgz' available in this post and store it in the share fvdw
- 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.
- edit the file /etc/php.ini, add the lines
Code: Select all
extension=mysqli.so
extension=bz2.so
extension=zip.so
(better in the same area as the other extensions, lines ~585)
- restart gracefully apache web server, open a terminal and enter the command
Code: Select all
httpd -f httpd.conf -d /etc -k graceful


Then from a browser, use these url:
- help docs : http://yournasmane/phpmyadmin/doc/html
- to setup phpmyadmin : http://yournasmane/phpmyadmin/setup (required to create your conf file: config.inc.php; download it and store it at the root level of phpMyAdmin-4.9.7-zzzz)
- to open a phpmyadmin session : http://yournasmane/phpmyadmin/

of course you have to read the help docs
Jocko
Site Admin - expert
 
Posts: 11367
Joined: Tue Apr 12, 2011 4:48 pm
Location: Orleans, France

Re: How to host a website on 5big Network2

Postby lisek » Thu Apr 29, 2021 6:46 pm

I understand... thanks Jocko.

The info about PHP version is a message from Wordpress installer:
- Your server is running PHP version 5.6.6 but WordPress 5.7.1 requires at least 5.6.20 -
So, the Wordpress (myweb/wp-admin/setup-config.php) installation stops on the message.

That's mean I will have to find an older Wordpress version installer, run it, and then try to update a working instance of the Wordpress, or find how to 'cheat' the Wordpress newest installer...

I don't give up :)
lisek
Donator VIP
Donator VIP
 
Posts: 20
Joined: Fri Feb 01, 2019 9:15 pm

Re: How to host a website on 5big Network2

Postby Jocko » Thu Apr 29, 2021 7:05 pm

Nope you can easily do a workaround about this

In the folder wp-includes, you have a file version.php, edit the file and change the line
Code: Select all
/**
 * Holds the required PHP version.
 *
 * @global string $required_php_version
 */
$required_php_version = '5.6.20'
(so replace 5.6.20 by 5.6.6 (and of course keep the single quotes)
Jocko
Site Admin - expert
 
Posts: 11367
Joined: Tue Apr 12, 2011 4:48 pm
Location: Orleans, France

Re: How to host a website on 5big Network2

Postby lisek » Thu Apr 29, 2021 7:29 pm

I told you that I'm not an expert, but as well not completely an idiot :thinking
Thanks ;)
lisek
Donator VIP
Donator VIP
 
Posts: 20
Joined: Fri Feb 01, 2019 9:15 pm

Next

Return to Lacie 5big Network vs2

Who is online

Users browsing this forum: No registered users and 1 guest