| thttpd Web Server |
|
|
|
| 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. If you are the lucky owner of any of the above devices, you have come to the right place. After following the steps in this guide, your ASUS WL device will have all its normal functionality, Guide Index1. 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 PrerequisitesAll you need is :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 ServerBe sure your ipkg packagelist is up to date, and the thttpd webserver with php support. /opt/bin/ipkg update < enter > IF one of the commands return some text ended by: "Segmentation fault" try to issue the same command again. /opt/bin/ipkg install php-thttpd < enter > It seems like the ipkg version is not completely stable. Now you have successfully installed a php enabled webserver Configuring the web serverThe 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 > Edit the webserver configuration file : mkdir /opt/share/www < enter > /opt/bin/nano /opt/etc/thttpd.conf < enter > Change the file so that it contains : dir=/opt/share/www Save the file by pressing < ctrl > + O followed by < enter >, exit nano with < ctrl > + X followed by < enter > port=81 user=nobody nochroot nosymlink novhost logfile=/opt/var/log/thttpd.log pidfile=/opt/var/run/thttpd.pid Create a couple of directories: mkdir /opt/var < enter > Now you can make a test-webpage by typing : mkdir /opt/var/log < enter > mkdir /opt/var/run < enter > echo "This is my test webspace" > /opt/share/www/index.htm < enter > Making the webserver startup at boot, and making it accessible from WANIf 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 The above will open the firewall for web connections.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 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 > That is basically it, reboot your ASUS WL device, and enjoy your ssh and web-server :-) flashfs commit < enter > flashfs enable < enter > 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 > |
|---|







