Tried to "install" ffp on my Zyxel NAS 220 plus

Marvell Orion based
tridy
Posts: 9
Joined: Tue Dec 10, 2013 10:05 am

Re: Tried to "install" ffp on my Zyxel NAS 220 plus

Post by tridy » Wed Dec 11, 2013 3:32 pm

Thanks.
Mijzelf wrote:...But there is lighttpd (which is already installed, BTW).
Well, as long as there is some kind of web server, it's already a great addition to my NAS.
I wonder if Lighttpd + Mono ASP.Net solution will work in this case. Could it be possible?

Mijzelf
Posts: 6203
Joined: Mon Jun 16, 2008 10:45 am

Re: Tried to "install" ffp on my Zyxel NAS 220 plus

Post by Mijzelf » Wed Dec 11, 2013 6:26 pm

Mono. I don't know. You box has an outdated kernel, and uses OABI. That has as consequence that uClibc is rather old too. It is possible that Mono won't build on that.
Well, as long as there is some kind of web server, it's already a great addition to my NAS.
You are aware that the box is already running Apache? It serves the webinterface. Further there is an PHP+MySQL+phpMyAdmin installable package. It's relatively easy to start your own instance of Apache using adapted configuration files.

tridy
Posts: 9
Joined: Tue Dec 10, 2013 10:05 am

Re: Tried to "install" ffp on my Zyxel NAS 220 plus

Post by tridy » Wed Dec 11, 2013 10:30 pm

Mijzelf wrote:Mono. I don't know. You box has an outdated kernel, and uses OABI. That has as consequence that uClibc is rather old too. It is possible that Mono won't build on that.
Well, as long as there is some kind of web server, it's already a great addition to my NAS.
You are aware that the box is already running Apache? It serves the webinterface. Further there is an PHP+MySQL+phpMyAdmin installable package. It's relatively easy to start your own instance of Apache using adapted configuration files.
Ah, that's probably where I should have continued in the first place.

I have PHP-MySQL-phpMyAdmin installed and I did the web publishing and it was viewing my test pages properly.

The only problem I had was that I was not able to access MySQL from the computer with SQL Manager, for example (I think I read somewhere that it's not possible). That's why I thought that having FFP will allow having both web server and MySQL accessible from outside NAS.

So, going back to the packages - is it possible to access MySQL that came with PHP-MySQL-phpMyAdmin package? Which hots name and port should I use? Or do I need a special setup for MySQL?

Could you also give me a hint on starting your own instance of Apache using adapted configuration files, please.

Thanks!

Mijzelf
Posts: 6203
Joined: Mon Jun 16, 2008 10:45 am

Re: Tried to "install" ffp on my Zyxel NAS 220 plus

Post by Mijzelf » Thu Dec 12, 2013 12:38 pm

tridy wrote:Could you also give me a hint on starting your own instance of Apache using adapted configuration files, please.
On my 325, the actual start of apache (in /etc/init.d/httpd.sh) is done this way:

Code: Select all

/sbin/start-stop-daemon --start --quiet --exec /usr/sbin/httpd -- -f /etc/service_conf/httpd.conf
If we ignore the start-stop-daemon, this boils down to

Code: Select all

/usr/sbin/httpd -f /etc/service_conf/httpd.conf
Apache is started, and told to use /etc/service_conf/httpd.conf as configuration.

So if you create your own configuration file, for instance /ffp/etc/httpd/httpd.conf, and start Apache like

Code: Select all

/usr/sbin/httpd -f /ffp/etc/httpd/httpd.conf
you have a 2nd instance running a different configuration.

Note: It's important to configure a different port (than 80) as only one daemon can use that port at a time.
Note2: Due to the chrooted nature of your FFP, you can find the firmware /etc in /ffp/etc/original/
So, going back to the packages - is it possible to access MySQL that came with PHP-MySQL-phpMyAdmin package?
I think yes, but I don't have an exact walkthrough. Have a look here. BTW, your local webserver/php should be able to access it anyway. You need to apply an my.cnf to be able to connect over the network.

tridy
Posts: 9
Joined: Tue Dec 10, 2013 10:05 am

Re: Tried to "install" ffp on my Zyxel NAS 220 plus

Post by tridy » Thu Dec 12, 2013 11:44 pm

On my 325, the actual start of apache (in /etc/init.d/httpd.sh) is done this way:
Ok, thanks to you, I have learned and moved a little bit forward.

I have found the following files:
ffp\etc\original\init.d\httpd.sh

that has the following code:

Code: Select all

/sbin/start-stop-daemon --start --quiet --exec /usr/sbin/httpd -- -f /etc/service_conf/httpd.conf 
where httpd.conf is actually locaded here:
ffp\etc\original\service_conf\httpd.conf
(p.s. why is "original" folder is there? does it get ignored by the script?)

then httpd.conf has the the following code:

Code: Select all

Include /etc/service_conf/httpd_zld.conf
which is located here:
ffp\etc\original\service_conf\httpd_zld.conf

that includes the following lines:

Code: Select all

Listen 80
Listen 443
so, now I probably need to
1. create a copy of httpd.conf in /ffp/etc/httpd/
2. create a copy of httpd_zld.conf in /ffp/etc/httpd/
3. edit ports for Listen 81 and Listen 444, for example.
4. add another exec to add to httpd.sh to start another instance:
/usr/sbin/httpd -f /ffp/etc/httpd/httpd.conf to both start and reload

With that I will probably get another instance of the same manager page on port 81.

I tried that but when I execute httpd command, I get the following error:

httpd: Could not open configuration file /usr/local/apache2/conf/httpd.conf: No such file or directory

I do not remember setting apache2 to any of the paths.

Is there more configuration I need to edit for running manager page on another instance and different port (as a beginning, to make sure it works)?


-- how do I execute httpd and tell it to restart? Or how do I restart apache so it would start 2 instances? do I need to reboot NAS?
-- in my copy of httpd_zld, how do I specify to use some folder from the hard drive and not from ffp stick?
-- what will happen to the edited httpd.sh and my copies of httpd.conf and httpd_zld.conf after I reboot NAS?

thanks!

Mijzelf
Posts: 6203
Joined: Mon Jun 16, 2008 10:45 am

Re: Tried to "install" ffp on my Zyxel NAS 220 plus

Post by Mijzelf » Fri Dec 13, 2013 9:34 am

tridy wrote:p.s. why is "original" folder is there? does it get ignored by the script?
It's due to the chrooted nature of your FFP. FFP needs a directory or symlink /ffp, and on my NSA220 / was readonly, actually the rootfs was a squashfs in flash.
So to be able to get a /ffp, I had to chroot it, which means ffp 'sees' another / than the firmware does. (chroot means CHange ROOT).
A large part of the firmware tree is more or less visible by an complicated system of mounts, symlinks and bindmounts.
And due to a reason I cannot remember at the moment, I couldn't put the firmware /etc in /etc, so it's in /ffp/etc/original. But for the firmware it's still /etc!.

Maybe chrooting is no longer necessary on the latest firmware. You can try to edit the header of after_booting.sh. There is a variable CHROOT=auto, you could change that in CHROOT=no. After a reboot the stick will try to not chroot, and fallback on chroot if that fails. ffpboot.log can tell you.
If you want to try this, make sure your loginless telnet daemon still works, as I have no idea if you will be able to login over ssh. In unchrooted state the firmware /etc/passwd is in charge.
httpd: Could not open configuration file /usr/local/apache2/conf/httpd.conf: No such file or directory
I guess that directory is somehow included (maybe indirect) in one of the conf file. Try to find and follow all includes.
-- how do I execute httpd and tell it to restart? Or how do I restart apache so it would start 2 instances?
The idea is that you and the firmware maintain their own instance of httpd. So the firmware uses it's own startscript, and you yours. About restarting, well, have a look if you can tell apache to create a pid file. In that fill the daemon writes it's pid, so you know who to kill. Something like

Code: Select all

if [ -e /ffp/run/httpd ] ; then
    kill ` cat /ffp/run/httpd `
fi
-- in my copy of httpd_zld, how do I specify to use some folder from the hard drive and not from ffp stick?
By specifying a document root on harddisk?
-- what will happen to the edited httpd.sh and my copies of httpd.conf and httpd_zld.conf after I reboot NAS?
Nothing. You copied them to /ffp/etc/, which is safely on stick. (With exception of /ffp/etc/original/)

tridy
Posts: 9
Joined: Tue Dec 10, 2013 10:05 am

Re: Tried to "install" ffp on my Zyxel NAS 220 plus

Post by tridy » Sun Dec 15, 2013 11:06 pm

I think I figured out how to start the instance of apache but I think I am doing alright with just publishing the pages via admin page.
so the problem now is mysql and being able to access it externally. my.cnf isn' really there anywhere, and it is probably because it is installed via PHP-MySQL-phpMyAdmin and not as a separate MySql package.

here are the files that I have found under 'ffproot\i-data\' and could be related to the issue but I don't really know if it can help at all and if it can what can I changed:

Code: Select all

config.huge.ini
config.medium.ini
config.small.ini
mysql.server
nbd-config-2-node.ini
[/url]

download: http://tinyurl.com/q5g4bsq

is there anything I could try to make mysql connect over network?

thanks

Mijzelf
Posts: 6203
Joined: Mon Jun 16, 2008 10:45 am

Re: Tried to "install" ffp on my Zyxel NAS 220 plus

Post by Mijzelf » Mon Dec 16, 2013 12:34 pm

As I already told in that link to zyxelforum.de, it seems MySQL is using internal settings. But maybe you can change the startscript to let it use another file.
Of course you can also install FFP MySQL, and disable the zypkg MySQL by renaming it's binary, or something like that.

Post Reply