Difference between revisions of "Lighttpd - Compile & Run on MIPSel Linkstation (LS2)"

From NAS-Central Buffalo - The Linkstation Wiki
Jump to: navigation, search
(How To Compile & run Lighttpd on the LS2)
 
Line 1: Line 1:
Due to the lack of Large File support (>2Gb) in the built in thttpd installation on my Linkstation (LS2) I decided to try [http://lighttpd.net Lighttpd] instead.
 
Below is the steps I used to compile and install Lighttpd on my Linkstation.
 
  
Download and install the development tools
 
[http://linkstationwiki.net/index.php?title=Precompiled_C_development_environment%2C_running_on_the_LS#MIPSel Precompiled C Development Environment]
 
 
Download the Lighttpd source code and untar it to a directory to do the compiling in.
 
 
<pre>
 
wget http://lighttpd.net/download/lighttpd-1.4.12.tar.gz
 
mkdir lighttpd
 
cd lighttpd
 
tar xzvf ../lighttpd-1.4.12.tar.gz
 
</pre>
 
 
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 [http://trac.lighttpd.net/trac/wiki/OptionalLibraries 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.
 
 
<pre>
 
./configure
 
make
 
make install
 
</pre>
 
 
Copy the full config file to the right directory ...
 
 
<pre>
 
mkdir /etc/lighttpd/
 
cp doc/lighttpd.conf /etc/lighttpd/lighttpd.conf
 
</pre>
 
 
Write a simple test config file (/tmp/lighttpd.conf)...
 
 
<pre>
 
server.document-root = "/www/"
 
server.port = 3000
 
mimetype.assign = (
 
  ".html" => "text/html",
 
  ".txt" => "text/plain",
 
  ".jpg" => "image/jpeg",
 
  ".png" => "image/png"
 
)
 
</pre>
 
 
Check the simple test config file...
 
 
<pre>
 
/usr/local/sbin/lighttpd -t -f /tmp/lighttpd.conf
 
</pre>
 
 
If all is well, Run the simple test config...
 
 
<pre>
 
/usr/local/sbin/lighttpd -D -f  /tmp/lighttpd.conf
 
</pre>
 
 
look at ...  the page in web browser by pointing your web browser to...
 
 
<pre>
 
http://serverIP:3000/
 
</pre>
 
 
Press CTRL^C to terminate the process...
 
 
Next you need to Edit the full config file.
 
 
<pre>
 
vi /etc/lighttpd/lighttpd.conf
 
</pre>
 
 
NOTE:-If you do not have "libpcre" during the compile then you need to comment out the following lines in the .conf file...
 
 
<pre>
 
#$HTTP["url"] =~ "\.pdf$" {
 
#  server.range-requests = "disable"
 
#}
 
</pre>
 
 
Check the full config and then test it...
 
 
<pre>
 
/usr/local/sbin/lighttpd -t -f /etc/lighttpd/lighttpd.conf
 
 
/usr/local/sbin/lighttpd -D -f /etc/lighttpd/lighttpd.conf
 
</pre>
 
 
Assuming all is well then you can create a startup process to automatically run the daemon at startup.
 
 
<pre>
 
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
 
</pre>
 
 
All Done! The server can now serve Large Files.
 
I hope this is usefull to someone.
 

Revision as of 20:07, 5 October 2006