1a - For Arm devices setup Debian Wheezy from here (remove lighttpd if is installed from optware with ipkg remove lighttpd or opkg remove lighttpd if installed from entware)
1b - For Mipsel devices setup Debian Wheezy from here (remove lighttpd if is installed from optware with ipkg remove lighttpd or opkg remove lighttpd if installed from entware)
2 - Enter chrooted debian with:
3 - Update Debian
apt-get upgrade
4 - Install necessary packages
5 - Change server port
6 - Reduce memory limit
7 - Start server
8 - Go to 192.168.1.1:81 and if you see this page, the lighttpd web server is configured correctly
9 - Enable PHP
10 - Restart server
11 - Create info page
Paste this lines
<?php phpinfo(); ?>
Save with CTRL-O, press ENTER and exit nano with CTRL-X
12 - Go to 192.168.1.1:81/info.php and if you see this page, php is configured correctly
13 - To create startup script we need to exit debian
14 - Add lighttpd to chroted services list
echo "S80lighttpd-debian" >>/opt/etc/chroot-services.list
chmod 755 /opt/etc/chroot-services.list
15 - Create post-mount script
Paste this lines
#!/bin/sh
sleep 10
/opt/etc/init.d/S99debian start
Save with CTRL-O, press ENTER and exit nano with CTRL-X
16 - Make script executable
17 - Rename original script to enable autostart from outside debian
18 - Start lighttpd from outside debian together with mounted external folder
19 - Go to 192.168.1.1:81 and should see your homepage
ACCESS THE WEBSITE FROM WAN
Paste this lines
#!/bin/sh
iptables -I INPUT -p tcp --destination-port 81 -j ACCEPT
sh /jffs/scripts/firewall-start
Go to Port Forwarding page https://192.168.1.1/Advanced_VirtualServer_Content.asp and redirect port 80 to 81, now you should have access from wan.