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

Addon: Custom Webserver

Discussion in 'Tomato Firmware' started by xcooling, Jun 13, 2008.

  1. xcooling

    xcooling LI Guru Member

    This is a very early Alpha.. but it does work.

    Guys I need ur help with this one

    Limitations/know bugs:
    .htacess not working
    default root gives error ( 500 Unknown Read error )
    have to specify the page ( http://192.168.1.1:999/index.htm)
    requires a login ( default tomato config details)

    Todo:
    Custom 404 redirect page
    .htacces usage

    Assumptions:
    Port :999
    Routers IP: 192.168.1.1
    directory: /tmp/www/


    http://192.168.1.1:999/index.htm

    Code:
    #!/bin/sh
    
    #// Webserver : Version 0.0.1 : 13 June 2008
    #//
    #// Created by Adrian Jon Kriel: root-AT-extremecooling-DOT-org
    #//
    #// Uses (either): 
    #// Serving http content
    #//
    #// Goals:
    #// To tidy adblocking (blocked traffic redirected to the wedserver and having micro content fill the blocked content)
    #// serve cusom pages
    #//  
    #// Create a shellscript containing the following and chmod 777 (/tmp/websetup.sh) or paste the following into the console.
    #// 
     
    
    #//varibles
    eval WWWPORT="999"
    eval WWWDIR="/tmp/www"
    
    #// Create temp www directory
    mkdir $WWWDIR
    
    #// Create .htaccess
    touch $WWWDIR/.htaccess
    chmod 666 $WWWDIR/.htaccess
    cat > $WWWDIR/.htaccess <<EOF
    errordocument 400 http://www.google.com/
    errordocument 404 http://192.168.1.1/
    errordocument 405 http://www.google.com/
    errordocument 414 http://www.google.com/
    RedirectMatch 301 \.gif$ http://www.google.com/logos/Logo_60wht.gif
    RedirectMatch 301 \.jpg$ http://www.google.com/logos/Logo_60wht.gif
    RedirectMatch 301 .*banner.* http://www.google.com/logos/Logo_60wht.gif
    RedirectMatch 301 ^image http://www.google.com/logos/Logo_60wht.gif
    
    EOF
    
    #// Create index.htm
    touch $WWWDIR/index.htm
    chmod 666 $WWWDIR/index.htm
    cat > $WWWDIR/index.htm <<EOF
    <html>
    <head><title>IT WORKS</title></head>
    <body><H2>IT WORKS</H2></body>
    </html>
    
    EOF
    
    #// Display some info
    echo "Launch webbrowser: http://192.168.1.1:$WWWPORT/index.htm"
    echo "CTRL + C to stop the test webserver (non deamon mode)"
    
    #// Launch webserver to test
    /usr/sbin/httpd -d -p $WWWPORT $WWWDIR
     
  2. xcooling

    xcooling LI Guru Member

    Found silentaccord post http://www.linksysinfo.org/forums/showpost.php?p=304675&postcount=8
    ^^ this method is far from ideal, to load another 1MByte of data onto the router is something thats not a viable option.

    Does anyone know the current httpd server is based on ( i know its been customised)

    either:
    mini_httpd (1.19 ?) or micro_httpd (12dec2005 ?)
     
  3. xcooling

    xcooling LI Guru Member

    Anyone able to offer any info or support ?
     

Share This Page