1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

[Cook book] Custom web server on NAS200

Discussion in 'Cisco/Linksys Network Storage Devices' started by negllic, Jul 30, 2009.

  1. negllic

    negllic Addicted to LI Member

    Hi all,

    Few weeks ago I asked on this forum "how to run a web site on NAS200"

    Jac_goudsmit gave me a large response (see this post).

    After several testing, I finally succeed !!

    I'm here to share my experience... Here is a small "cook book" for that :

    1. Upgrade your NAS with JacXX firmware. I suggest Jac3 firmware. (With Jac2b, startup scripts were not called on my NAS200...maybe because I'm in RAID configuration)
    2. Your startup script SHOULD NOT start /usr/sbin/thttpd. Why ?? Simply because after custom startup scripts, NAS200 calls several scripts in which there is /etc/rc.d/rc.thttpd. And this script kill all thttpd process including yours !!! The solution I found is to start thttpd under an other name.
    3. thttpd on NAS200 is compiled to start index.cgi by default. Therefore, you need a small cgi script to redirect the browser to index.html.

    Here are scripts and config files (you should change volume_x to your config) :

    rc.myweb
    Code:
    if [ ! -h /harddisk/volume_3/data/rc.d/myhttpd ]
    then
       ln -s /usr/sbin/thttpd /harddisk/volume_3/data/rc.d/myhttpd
    fi
    
    #Arrêt myhttpd qui existerait en mémoire
    /bin/killall myhttpd 2>/dev/null
    
    # Lancement
    /harddisk/volume_3/data/rc.d/myhttpd -C /harddisk/volume_3/data/rc.d/thttpd.conf
    
    thttpd.conf
    Code:
    dir=/harddisk/volume_3/data/webroot
    nochroot
    nosymlink
    user=root
    pidfile=/var/run/thttpd-webphoto.pid
    cgipat=*.cgi
    port=80
    
    index.cgi
    Code:
    #!/bin/sh
    echo "Status:302"
    echo "location:index.html"
    exit 0
    

    I'm quite sure that everything can be improved. I'm quite a newbie to linux :smile:...
    Feel free to post any comment !

    but I do believe that this post will be usefull for someone !

    Christophe.
     

Share This Page