www.mamboteam.com
macsat.com - OpenWrt | Olegs Firmware  
Home arrow Tutorials - OpenWrt (White Russian) arrow thttpd Web Server
Friday, 21 November 2008
 
 
Main Menu
Home
About
News
Tutorials - OpenWrt (WR)
Tutorials - Oleg
Wiki (RDC Based Routers)
Online Shop
Forum
Downloads
Free Linux eBooks
Links
Search
Contact Us
We have 4 guests online
2811382 Visitors
Login
Welcome Guest.






Lost Password?
No account yet? Register
Old macsat.com
Nokia Unlock (Dansk)
Nokia Unlock (English)
XBins IRC Chat
thttpd Web Server PDF Print E-mail
(10 votes)
Written by macsat   
Friday, 25 November 2005

This is a step for step guide for turning your ASUS WLxxxx linux-based wireless product, into a small php enabled web server.
Following the guide will not change the default features of your device, it will just add some nice functionality to it.
The guide is made using a ASUS WL-500G Deluxe (or WL-500GX as it is sometimes called).
It should however apply to all the ASUS wireless line of products that are Linux based. Theese products are to my knowledge :

  • ASUS WL-500b
  • ASUS WL-500bv2
  • ASUS WL-500g
  • ASUS WL-500g Deluxe (WL500-gx)
  • ASUS WL-HDD
  • If you are the lucky owner of any of the above devices, you have come to the right place.
    If you still dont have one of the above devices - dont hesitate, go buy one :-)

    After following the steps in this guide, your ASUS WL device will have all its normal functionality,
    and also contain a full featured PHP enabled web server that can be accessed from the WAN (Internet).

    Guide Index

    1. Prerequisites - What is needed to get started.
    2. Installing web server
    3. Configuring the web server
    4. Making the web server start at boot, and making it from WAN

    Prerequisites

    All you need is :
  • One of the above Asus Wireless devices
  • An USB Harddrive or USB Memory Stick / Keyring with some 50-100 MB space.(For the WL-HDD you just need a regular Harddrive)
  • Firmware version 1.9.2.7-4 (or higher) by Oleg
  • The ipkg package system

  • If you dont already own one of the ASUS devices above, but consider buying one in order to take advantage of the server-possibilities,
    you should probably go for the WL-500gx or the WL-HDD. The WL-500gx has USB2.0 and the WL-HDD uses a normal IDE interface,
    while the other devices uses the slow USB 1.1 interface.

    Installing Web Server

    Be sure your ipkg packagelist is up to date, and the thttpd webserver with php support.
    /opt/bin/ipkg update < enter >
    /opt/bin/ipkg install php-thttpd < enter >
    IF one of the commands return some text ended by: "Segmentation fault" try to issue the same command again.
    It seems like the ipkg version is not completely stable.

    Now you have successfully installed a php enabled webserver

    Configuring the web server

    The webserver is quite easy to configure. First choose a place to store the html/php files. A good idea would be to choose /opt/share/www
    mkdir /opt/share/ < enter >
    mkdir /opt/share/www < enter >
    Edit the webserver configuration file :
    /opt/bin/nano /opt/etc/thttpd.conf < enter >
    Change the file so that it contains :
    dir=/opt/share/www
    port=81
    user=nobody
    nochroot
    nosymlink
    novhost
    logfile=/opt/var/log/thttpd.log
    pidfile=/opt/var/run/thttpd.pid
    Save the file by pressing < ctrl > + O followed by < enter >, exit nano with < ctrl > + X followed by < enter >
    Create a couple of directories:
    mkdir /opt/var < enter >
    mkdir /opt/var/log < enter >
    mkdir /opt/var/run < enter >
    Now you can make a test-webpage by typing :
    echo "This is my test webspace" > /opt/share/www/index.htm < enter >

    Making the webserver startup at boot, and making it accessible from WAN

    If you have followed the ipkg tutorial the webserver should automaticly start on next reboot!

    Now you need to open your firewall, to accept WAN (Internet) connections to your ssh and new www servers.
    (theese services are running on port 22 and port 80)
    Paste this into post-firewall:
    #!/bin/sh
    iptables -D INPUT -j DROP
    iptables -A INPUT -p tcp --dport 81 -j ACCEPT
    iptables -A INPUT -p tcp --dport 80 -j ACCEPT
    iptables -t nat -A PREROUTING -i $1 -p tcp --dport 80 -j DNAT --to-destination $4:81

    iptables -A INPUT -j DROP
    The above will open the firewall for web connections.

    Only thing now, is to save the changes we made. Since /usr/local/sbin is not on the USB disk we connected,
    but instead in the internal flash memory of the ASUS Device, we need to save it to flash and tell the router
    to use the files by enabling flashfs :
    flashfs save < enter >
    flashfs commit < enter >
    flashfs enable < enter >
    That is basically it, reboot your ASUS WL device, and enjoy your ssh and web-server :-)
    reboot < enter >
    I hope you found this guide useful.
    Comments are welcome to This e-mail address is being protected from spam bots, you need JavaScript enabled to view it
    Last Updated ( Tuesday, 10 January 2006 )
     
    < Prev   Next >
    Buy Router
    Linksys Wireless-N Broadband Router WRT300N
    Linksys Wireless-N Broadband Router WRT300N
    Recent Forum Topics
    Donations

    If you appriciate this site, please consider making a small donation.

    All donations will be used to cover expenses from running macsat.com.

    Sponsored Ads
     
    Top! Top!