Add shares to built-in lighthttpd server
Preconditions
- sshd enabled
- optware installed
1 make shares fiolders
su
mkdir /usr/www/lib/shares
ln -s TO_SHARE_DIR /usr/www/lib/shares/
2. Install htpasswd tool
download expat file expat-2.0.1.tar.gz from http://expat.sourceforge.net/
for eaxmple, directly get it from
wget http://internode.dl.sourceforge.net/sourceforge/expat/expat-2.0.1.tar.gz
tar zxvf expat-2.0.1.tar.gz
cd expat-2.0.1
./configure
make buildlib
make installlib
install appache etc, as we need htpasswd
ipkg install apache apache-manual php-apache
3 create htppasswd password
htpasswd -c /etc/lighttpd/lighttpd-htpasswd.user shareuser
type and confirm password
4 modify /etc/lighttpd/lighttpd.conf
change
alias.url = ( "/auth" => "/usr/www/lib")
to
alias.url = ( "/auth" => "/usr/www/lib",
"/shares" => "/usr/www/lib/shares" )
AND ADD this
$HTTP["url"] == "/shares/" {
auth.backend = "htpasswd"
auth.backend.htpasswd.userfile = "/etc/lighttpd/lighttpd-htpasswd.user"
auth.require = ("/shares" => (
"method" => "basic",
"realm" => "share Club",
"require" => "valid-user"
))
}
5 reload or restart lighttpd
/etc/init.d/lighttpd.sh reload
6. open your web browser and point to
http://<MYBOOKWORLD>/shares
it will pop up a window for user and password
You are on flight!!
Linux Toys
http://linuxishbell.wordpress.com/