Lighttpd - Compile & Run on MIPSel Linkstation (LS2)

From NAS-Central Buffalo - The Linkstation Wiki
Jump to: navigation, search

Due to the lack of Large File support (>2Gb) in the built in thttpd installation on my Linkstation (LS2) I decided to try Lighttpd instead. Below is the steps I used to compile and install Lighttpd on my Linkstation.

Download and install the development tools Precompiled C Development Environment

Download the Lighttpd source code and untar it to a directory to do the compiling in.

mkdir lighttpd
cd lighttpd
tar xzvf ../lighttpd-1.4.12.tar.gz

The Lighttpd web site states that there are additional libraries needed. However they do not appear to be needed if you do not need some of the modules. See Optional Libraries The libraries I was missing are "libpcre" and "libz".

Configure the Compilation package to install the files to the /usr/local directory and compile the program.

make install

Copy the full config file to the right directory ...

mkdir /etc/lighttpd/
cp doc/lighttpd.conf /etc/lighttpd/lighttpd.conf

Write a simple test config file (/tmp/lighttpd.conf)...

server.document-root = "/www/"
server.port = 3000
mimetype.assign = (
  ".html" => "text/html", 
  ".txt" => "text/plain",
  ".jpg" => "image/jpeg",
  ".png" => "image/png"

Check the simple test config file...

/usr/local/sbin/lighttpd -t -f /tmp/lighttpd.conf

If all is well, Run the simple test config...

/usr/local/sbin/lighttpd -D -f  /tmp/lighttpd.conf

look at ... the page in web browser by pointing your web browser to...


Press CTRL^C to terminate the process...

Next you need to Edit the full config file.

vi /etc/lighttpd/lighttpd.conf

NOTE:-If you do not have "libpcre" during the compile then you need to comment out the following lines in the .conf file...

#$HTTP["url"] =~ "\.pdf$" {
#  server.range-requests = "disable"

Check the full config and then test it...

/usr/local/sbin/lighttpd -t -f /etc/lighttpd/lighttpd.conf

/usr/local/sbin/lighttpd -D -f /etc/lighttpd/lighttpd.conf

Assuming all is well then you can create a startup process to automatically run the daemon at startup.

echo "/usr/local/sbin/lighttpd -f  /etc/lighttpd/lighttpd.conf" > /etc/init.d/lighttpd
chmod +x /etc/init.d/lighttpd

cd /etc/rc.d/rc2.d/
ln -s ../init.d/lighttpd S90lighttpd
cd /etc/rc.d/rc0.d/
ln -s ../init.d/lighttpd K90lighttpd
cd /etc/rc.d/rc6.d/
ln -s ../init.d/lighttpd K90lighttpd

All Done! The server can now serve Large Files.
I hope this is usefull to someone.

The Precompiled package I made can be downloaded from here for those of you who don't want to compile it yourself... lighttpd-1.4.12_mips.tar.gz