Run a second instance of thttpd (on an alternate port)

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

This article Based on work by andre, mindbender, JaneyB, and frontalot. Originally by frontalot. at

LS2 or LS1/HG? | if you have a LinkStation I/HG you need to change /mnt/hda/share to /mnt/share wherever it occurs. Check to see which directory exists on your LinkStation.

1. The following should work if you are starting from scratch. Start by making your new www directory:

mkdir -p /mnt/hda/share/www

2. Create a symbolic link for thttpd2 (the new web server):

ln /usr/sbin/thttpd /usr/sbin/thttpd2

3. Create a new PID for thttpd2:

sed -e "s@thttpd@thttpd2@g ; s@dir=/www@dir=/mnt/hda/share/www/@ ; s@port=80@port=81@" /etc/thttpd.conf > /etc/thttpd2.conf
sed -e "s@thttpd@thttpd2@g" /etc/init.d/thttpd > /etc/init.d/thttpd2

4. Make the thttpd2 startup script executable:

chmod +x /etc/init.d/thttpd2

5. Start the thttpd2 server:

/etc/init.d/thttpd2 start

403 Error? | Do you receive a 403 error when you try to access the web server? Check the ownership and permission of your website files. The owner should be whatever user thttpd2 runs as and the permission should be 644 for HTML and 755 for CGI.

6. To make the second thttpd start and stop on reboot, you need something like:

ln -s /etc/init.d/thttpd2 /etc/rc.d/rc2.d/S20thttpd2
ln -s /etc/init.d/thttpd2 /etc/rc.d/rc0.d/K20thttpd2
ln -s /etc/init.d/thttpd2 /etc/rc.d/rc6.d/K20thttpd2