18.1.10

WD MyBook Hacks - Built-in Webserver

Apparently the white light version of MBWE broke up with lighttpd, and hooked up with mini_httpd. Reason for this is unknown for me, one thing is sure however: If you want to be on the safe side and use the web-based admin interface, it is better to live with it. I do believe that other http servers can be installed, including:
~#: ipkg list | grep httpd
lighttpd - 1.4.25-1 - A fast webserver with minimal memory footprint.
minihttpd - 1.19-2 - small HTTP server
nostromo - 1.9-1 - nhttpd is a simple, fast and secure HTTP server.
php-thttpd - 2.25b-5.2.12-1 - php-thttpd is thttpd webserver with php support
thttpd - 2.25b-5 - thttpd is a lightweight http server
Each has a separate way to configure, the only thing that has to be made sure is that it binds to a different port than the default 80. Or, even better the admin interface can be removed from port 80, by using -p command-line parameter discussed later on.
Anyhow, at the moment we deal with the mini_httpd:
~#: ps ax | grep http
 2566 root        832 S < /usr/sbin/mini_httpd -d /proto/SxM_webui -c **.mp3|**
16981 root        584 S   grep http
which tells us that the served directory is /proto/SxM_webui. This means that additional files or directories created there will be served as well by the daemon so it is suitable for share simple things not including password protection, virtual hosts and so on...
In fact, I did not find any reasonable online manual page for mini_httpd, yet its basic features are easy to find:
~#: mini_httpd --help
usage:  mini_httpd [-C configfile] [-D] [-S] [-E certfile] [-Y cipher] [-p port] [-d dir] [-dd data_dir] [-c cgipat] [-u user] [-h hostname] [-r] [-v] [-l logfile] [-i pidfile] [-T charset] [-P P3P] [-M maxage] [-maxproc max_concurrent_procs]
On my system /etc/init.d/S55mini_httpd starts the server with the following syntax:
/bin/nice -n -20 \
    /usr/sbin/mini_httpd \
    -d $WEBROOT \
    -c "**.mp3|**.m4a|**.mp4|**.mov|**.pdf|**.wma|**.m4v|**.php|**.cgi" \
    -u root \
    -l /var/log/mini_httpd.log \
    -i /var/run/mini_httpd.pid \
    -maxproc 16 \
    -p $HTTP_PORT
with $WEBROOT being just as above and $HTTP_PORT = "80".

4 comments:

  1. Attila,

    I have a WD My Book World Edition.

    I sometimes got the message:

    UNKNOWN 503 Server temporarily overloaded
    Date: Wed, 10 Feb 2010 06:47:24 GMT
    Cache-Control: no-cache,no-store
    Content-Type: text/html; charset=%s
    Connection: close

    .
    .
    .503 Server temporarily overloaded

    503 Server temporarily overloaded
    The server cannot process the request due to a high load
    .
    .
    .
    when using the ctorrent client.

    I logged in using SSH and found the mini_httpd process and thought that I would restart it to see if it would help. I wrote kill -"current process ID". And yes, it stopped.

    But now I can't start it again. I tried starting it using the code you provided above, but I can't make it work.

    It won't even start after rebooting the WD...
    The only thing that shows as I type 192.168.0.127 in the browser is this:
    Index of ./

    . 21Feb2010 22:06 4096
    .. 18Feb2010 19:56 4096
    .ash_history 21Feb2010 22:06 20
    .bash_history 23Mar2006 05:32 0
    .bash_logout 23Mar2006 05:32 175
    .bash_profile 23Mar2006 05:32 161
    .bashrc 23Mar2006 05:32 1711

    mini_httpd/1.19 19dec2003

    Can you please help me out?

    ReplyDelete
  2. Hi,
    It seems that the httpd serves the root home directory for some reason (quite strange though).
    Is "/proto/SxM_webui" still exist on your system?
    If so and it is not empty and readable than what says a "ps ax | grep http" ?
    You can also try to execute "/etc/init.d/S55mini_httpd"

    ReplyDelete
  3. Thanks for the reply. Yes, the proto/SxM_webui still exist. I found the script S55mini_httpd and by executing that by "sh S55mini_httpd start" the webserver started and now everything works normal again.

    ReplyDelete
  4. Hi,
    I have My Book World Edition Network Storage
    After i enabled SSH and disable FTP on it, i can’t log in it web interface and can’t even open its shared folders.

    When i try to log in to it i receive the below message even before i got a user name and password window.

    Index of ./

    . 09Feb2012 08:11 4096
    … 09Feb2012 08:11 4096
    ???admin 01Jan1970 02:00 4096
    ???eula 09Feb2012 08:11 4096
    help 09Feb2012 08:11 4096
    ???mionet 09Feb2012 08:11 4096
    ???share 09Feb2012 08:11 4096
    ???ui.css 18Mar2008 08:42 6439
    mini_httpd/1.19 19dec2003

    I tried to reset it to its default setting without lossing any data by pushing the reset button for 20 minute, but it wasn’t resetted

    Please help

    ReplyDelete