NSLU2-Linux
view · edit · print · history

HowTo.UseTheThttpdWebserver History

Hide minor edits - Show changes to markup

December 13, 2010, at 04:00 AM by Radale -- warning about second thttpd instance from package install
Changed line 5 from:
  1. Copy and rename the thttpd executable cp /usr/sbin/thttpd /opt/sbin/mythttpd (or the WatchDog utility will become very confused). As an alternative on unslung (arguably better, since it does not include the custom Linksys code; arguably worse, since it is more sensitive to file and directory permissions), install the thttpd package (which gets you /opt/sbin/thttpd, so you will need to adjust the paths below).
to:
  1. Copy and rename the thttpd executable cp /usr/sbin/thttpd /opt/sbin/mythttpd (or the WatchDog utility will become very confused). As an alternative on unslung (arguably better, since it does not include the custom Linksys code; arguably worse, since it is more sensitive to file and directory permissions), install the thttpd package (which gets you /opt/sbin/thttpd, so you will need to adjust the paths below). (If the second thttpd is installed, then note that the installed startup script [/opt/etc/init.d/S80thttpd] contains a "killall thttpd" which may cause the admin pages server to be taken down.)
October 13, 2008, at 10:28 PM by Val -- Web pages must have read attribute enabled for group and other user
Changed line 9 from:
  1. Put your web pages in the directory you created above.
to:
  1. Put your web pages in the directory you created above. You might need to use chmod to set files attributes to follow this schema: -rwxr--r--
January 06, 2008, at 10:49 PM by bcrowell --
Deleted lines 32-33:
  • IMPORTANT NOTE - The NSLU2's built in Thttpd web server does not support the PHP script language. Users that need this functionality should install one of the Optware Web Server packages such as the PHP enabled Php-Thttpd or Apache or the PHP-FCGI enabled Cherokee or Lighttpd.
Changed lines 40-41 from:
to:
  • The NSLU2's built in Thttpd web server does not support the PHP script language. Users that need this functionality should install one of the Optware Web Server packages such as the PHP enabled Php-Thttpd or Apache or the PHP-FCGI enabled Cherokee or Lighttpd.
January 06, 2008, at 10:48 PM by bcrowell --
Added line 7:
  1. Create the directory /opt/var/log.
May 22, 2007, at 10:50 PM by RobHam -- Expanded file permissions section to include .pl .sh and .py executable file extensions
Changed lines 164-165 from:
  1. Note that some user prefer to use different user and groups
  2. such as nobody and everyone for improved server security.
to:
  1. Note that some users prefer to use different user and groups
  2. to improve server security, such as nobody and everyone
Changed lines 177-178 from:

If your web folder tree contains any executable files with extensions such as .cgi, .pl, .py or @@.sh@ then flag these using the script below. Change the file extension as required.

to:

If your web folder tree contains any executable files with extensions such as .cgi, .pl, .py or .sh then flag these using the script below. Change the file extension as required.

May 22, 2007, at 10:46 PM by RobHam -- Expanded file permissions section to include .pl .sh and .py executable file extensions
Changed lines 140-141 from:

Users of Thttpd, Php-Thttpd, Cherokee, Apache and other Optware web servers may find that they have difficulty serving some types of web page, in many cases this can be due to the individual file permissions settings. For a detailed discussion for the Thttpd server consult the web page :-

to:

Users of Thttpd, Php-Thttpd, Cherokee, Lighttpd, Apache and other Optware web servers may find that they have difficulty serving some types of web page, in many cases this can be due to the individual file permissions settings. For a detailed discussion for the Thttpd server consult the web page :-

Changed lines 144-145 from:

Most of the working Web based Optware packages for the NSLU2 e.g. dokuwiki, mediawiki, phpmyadmin have adopted the following rules

to:

Most of the working Web based Optware packages for the NSLU2 e.g. dokuwiki, mediawiki, phpmyadmin have adopted the following rules during instalation.

Changed lines 149-154 from:
  1. Flag all CGI executables - 755

It can prove quite difficult to flag large directory structures to these rules but the following script sections can be modified to cover most structures.

The following script section assumes that the data files are stored in the folder structure /opt/share/www/mywebpages - modify this directory name as required.

to:
  1. Flag all executables such as CGI, Perl, Python, Shell scripts etc. - 755

The following script sections can be used to flag large directory structures.

The scripts assume that the data files are stored in the folder structure /opt/share/www/mywebpages - modify this directory name as required.

Changed lines 163-165 from:
  1. 1. Start by globaly setting all files and directories with owner and group set to root
to:
  1. 1. Start by globaly setting all files and directories with owner and group set to root.
  2. Note that some user prefer to use different user and groups
  3. such as nobody and everyone for improved server security.
Deleted lines 173-175:
  1. 4. Finally search and chmod all cgi files to permission 755

find /opt/share/www/mywebpages -name *.cgi -exec chmod 0755 {} \; -print

Added lines 177-187:

If your web folder tree contains any executable files with extensions such as .cgi, .pl, .py or @@.sh@ then flag these using the script below. Change the file extension as required.

(:table border=0 width=100% bgcolor=#eeeeff:) (:cell:)

 
# 4. For CGI executable files, chmod all to permission 755
find /opt/share/www/mywebpages -name *.cgi -exec chmod 0755 {} \; -print
#

(:tableend:)

Changed lines 191-192 from:

RobHam - Jan 2006

to:

RobHam - Jan 2006 - expanded May 2007

March 30, 2007, at 06:15 PM by Olivier Harel -- Text layout
Changed line 199 from:

The only way to do it would be to specify umask=0000 when the drive is mounted, but I couldn't modify the mounting options for /dev/sdb1

to:

The only way to do it would be to specify umask=0000 when the drive is mounted, but I couldn't modify the mounting options for /dev/sdb1.

Changed lines 208-210 from:

- supports password authentication (using the htpasswd utility from the acme package) - does not bother me with world read permissions

to:
  1. supports password authentication (using the htpasswd utility from the acme package)
  2. does not bother me with world read permissions
March 30, 2007, at 06:13 PM by Olivier Harel -- Text layout
Changed lines 203-206 from:

1- Download the thttpd source code of the ACME thttpd binary (see MakeThttpdOnYourNSLU2Box) 2- Edit the libhttpd.c file and remove the few lines of code that do check for the world read permission flag. 3- Compile the binary as indicated in MakeThttpdOnYourNSLU2Box

to:
  1. Download the thttpd source code of the ACME thttpd binary (see MakeThttpdOnYourNSLU2Box)
  2. Edit the libhttpd.c file and remove the few lines of code that do check for the world read permission flag.
  3. Compile the binary as indicated in MakeThttpdOnYourNSLU2Box
March 30, 2007, at 06:12 PM by Olivier Harel --
Changed line 204 from:

2- Edit the thttpd lib file and remove the few lines of code that do check for the world read permission flag.

to:

2- Edit the libhttpd.c file and remove the few lines of code that do check for the world read permission flag.

March 30, 2007, at 06:10 PM by Olivier Harel -- thttpd, password authentication, file permissions and NTFS/UFSD drives
Added lines 183-213:

thttpd, password authentication, file permissions and NTFS/UFSD drives

I tried to setup password authentication with the thttpd binary (in /usr/sbin) that comes with the nlsu. It recognizes .htpasswd files but there's no htpasswd binary included to create them. I couldn't create .htpasswd files manually.

I downloaded the ACME httpd binary package(ipkg install httpd, the new binary is in /opt/sbin/) This binary has an advantage and a drawback when compared to the linksys binary. Advantage: the package includes a htpasswd utility Drawback : it is very picky about file permissions. It requires that all files (html/pictures...) be world readable in order to display them.

The htpasswd utility that comes with the acme thttpd package is not compatible with the thttpd binary from Linksys.

Using the acme httpd package I could setup password authentication on my web server. However most of my content is stored on a NTFS drive on disk1. It is mounted on /dev/sdb1 by the nslu using a nfsd driver (comes with the nslu). NTFS doesn't support per file world permission information. Using chmod I couldn't make my files and directories world readable on the NTFS drive. The only way to do it would be to specify umask=0000 when the drive is mounted, but I couldn't modify the mounting options for /dev/sdb1 I tried to mount the disk a second time on another mount point (using /etc/fstab), with umount=0000, but even in that mount, the files would have no world permission.

The only way around I found was to: 1- Download the thttpd source code of the ACME thttpd binary (see MakeThttpdOnYourNSLU2Box) 2- Edit the thttpd lib file and remove the few lines of code that do check for the world read permission flag. 3- Compile the binary as indicated in MakeThttpdOnYourNSLU2Box

The new binary: - supports password authentication (using the htpasswd utility from the acme package) - does not bother me with world read permissions

Olivier.


May 16, 2006, at 09:53 PM by Joaquim Baptista -- Oops! ipkg thttpd applies to everyone, not just opeNSLUg
Changed line 5 from:
  1. Copy and rename the thttpd executable cp /usr/sbin/thttpd /opt/sbin/mythttpd
to:
  1. Copy and rename the thttpd executable cp /usr/sbin/thttpd /opt/sbin/mythttpd (or the WatchDog utility will become very confused). As an alternative on unslung (arguably better, since it does not include the custom Linksys code; arguably worse, since it is more sensitive to file and directory permissions), install the thttpd package (which gets you /opt/sbin/thttpd, so you will need to adjust the paths below).
Deleted line 13:
  • Copy the stock thttpd to a new file (or the WatchDog utility will become very confused) as follows: cp /usr/sbin/thttpd /usr/sbin/mythttpd. As an alternative on unslung (arguably better, since it does not include the custom Linksys code; arguably worse, since it is more sensitive to file and directory permissions), install the thttpd package (which gets you /opt/sbin/thttpd, so you will need to adjust the paths below).
May 16, 2006, at 09:49 PM by Joaquim Baptista --
Changed line 14 from:
  • Copy the stock thttpd to a new file (or the WatchDog? utility will become very confused) as follows: cp /usr/sbin/thttpd /usr/sbin/mythttpd. As an alternative on unslung (arguably better, since it does not include the custom Linksys code; arguably worse, since it is more sensitive to file and directory permissions), install the thttpd package (which gets you /opt/sbin/thttpd, so you will need to adjust the paths below).
to:
  • Copy the stock thttpd to a new file (or the WatchDog utility will become very confused) as follows: cp /usr/sbin/thttpd /usr/sbin/mythttpd. As an alternative on unslung (arguably better, since it does not include the custom Linksys code; arguably worse, since it is more sensitive to file and directory permissions), install the thttpd package (which gets you /opt/sbin/thttpd, so you will need to adjust the paths below).
May 16, 2006, at 09:47 PM by Joaquim Baptista -- 900 is not a high-numbered port; note ipkg thttpd on unslung, at least.
Changed lines 3-4 from:
  1. If you intend running your second server on port 80 then set your existing admin web port to something other than 80 (e.g. 8080). This change must be done through the standard Linksys configuration page (last option on the Administration-->System page). If you just try to change the setting in the thttpd.conf file, it will be overwritten at boot. Note - Recommend setting the port number for your second server to an un-used high port number such as 900.
  2. Create a home directory for your web pages that you want shared: /opt/share/www is the recommended directory because it is compatable with many Optware packages.
to:
  1. If you intend running your second server on port 80 then set your existing admin web port to something other than 80 (e.g. 8080). This change must be done through the standard Linksys configuration page (last option on the Administration-->System page). If you just try to change the setting in the thttpd.conf file, it will be overwritten at boot. Note - Recommend setting the port number for your second server to an unused high port number such as 9000 (ie, above 1024).
  2. Create a home directory for your web pages that you want shared: /opt/share/www is the recommended directory because it is compatible with many Optware packages.
Changed lines 9-11 from:
  1. You can check that the second server is running on your lan using http://192.168.1.77:900 - this assumes that your second server is running on port 900 and the default Slug IP address. Note that the server software expects an index.html file to be present in the home folder to work correctly.
  2. To open your web server to the internet open up incomming port 80 on your router and forward it to port 900 on your NSLU2, most routers allow port forwarding across ports, config page for this is often hidden away under UPNP forwarding.
  3. If you want your second web server instance to automaticaly start after a re-boot of the slug then create a startup file in the folder /opt/etc/init.d using a script such as echo "/opt/sbin/mythttpd -C /opt/etc/mythttpd.conf" > /opt/etc/init.d/S81mythttpd. Note - don't forget to chmod +x /opt/etc/init.d/S81mythttpd.
to:
  1. You can check that the second server is running on your lan using http://192.168.1.77:9000 - this assumes that your second server is running on port 9000 and the default Slug IP address. Note that the server software expects an index.html file to be present in the home folder to work correctly.
  2. To open your web server to the internet open up incomming port 80 on your router and forward it to port 9000 on your NSLU2, most routers allow port forwarding across ports, config page for this is often hidden away under "UPNP forwarding" or "virtual servers".
  3. If you want your second web server instance to automaticaly start after a reboot of the slug then create a startup file in the folder /opt/etc/init.d using a script such as echo "/opt/sbin/mythttpd -C /opt/etc/mythttpd.conf" > /opt/etc/init.d/S81mythttpd. Note - don't forget to chmod +x /opt/etc/init.d/S81mythttpd.
Changed lines 13-15 from:

If you want your second web server instance to automaticaly start after a re-boot of the slug:

to:

If you want your second web server instance to automaticaly start after a reboot of the slug:

  • Copy the stock thttpd to a new file (or the WatchDog? utility will become very confused) as follows: cp /usr/sbin/thttpd /usr/sbin/mythttpd. As an alternative on unslung (arguably better, since it does not include the custom Linksys code; arguably worse, since it is more sensitive to file and directory permissions), install the thttpd package (which gets you /opt/sbin/thttpd, so you will need to adjust the paths below).
  • Create a startup file in the folder /etc/init.d using a script such as echo "/usr/sbin/mythttpd -C /etc/mythttpd.conf" > /etc/init.d/mythttpd. Don't forget to chmod +x /etc/init.d/mythttpd.
  • Run update-rc.d mythttpd defaults 60
Changed lines 18-20 from:

NaMeOfNeWsErVeR? - mythttpd in this example, located in /usr/sbin

to:
April 24, 2006, at 08:52 PM by RobHam -- Removed coments about the lack of avaliability of PHP-FCGI, now avaliable as an Optware down package.
Changed lines 33-41 from:
  • IMPORTANT NOTE - The NSLU2's built in Thttpd web server does not support the PHP script language. Users that need this functionality should install one of the Optware Web Server packages such as the PHP enabled Php-Thttpd, Apache or Cherokee with the cgiphp module.

[Comment] Lee Is there a cgiphp module for Cherokee? Is there a cgiphp module at all?

I can't find one on this site and I can't find one in the Optware Cherokee package. I have been unable to get Cherokee to work with php on an Unslung NSLU2.

[Comment Reply] Check out the following mailing list posting, perhaps one of the package maintainers will one day add this to the Ipkg feeds. http://groups.yahoo.com/group/nslu2-general/message/2975

to:
  • IMPORTANT NOTE - The NSLU2's built in Thttpd web server does not support the PHP script language. Users that need this functionality should install one of the Optware Web Server packages such as the PHP enabled Php-Thttpd or Apache or the PHP-FCGI enabled Cherokee or Lighttpd.
April 10, 2006, at 10:57 AM by Igor Sharov --
Changed lines 12-13 from:
to:

For opeNSLUg users ONLY! If you want your second web server instance to automaticaly start after a re-boot of the slug:

Otherwise the second server will not start!! NaMeOfNeWsErVeR? - mythttpd in this example, located in /usr/sbin

March 05, 2006, at 10:58 PM by RobHam -- File Permissions Section - flag PHP script files 644 added
Changed line 149 from:
  1. Flag all Data files such as html and picture files - 644
to:
  1. Flag all Data files such as html, PHP and picture files - 644
Deleted lines 184-188:

[Comment]

As to php scripts within the php-thttpd web server, what permission should I set them to?

Freddy Chu

March 05, 2006, at 12:29 PM by Freddy Chu --
Changed lines 184-185 from:
to:

[Comment]

As to php scripts within the php-thttpd web server, what permission should I set them to?

Freddy Chu

February 22, 2006, at 07:01 PM by RobHam -- CgiPhp comment reply added.
Changed lines 33-35 from:
to:

[Comment Reply] Check out the following mailing list posting, perhaps one of the package maintainers will one day add this to the Ipkg feeds. http://groups.yahoo.com/group/nslu2-general/message/2975

February 21, 2006, at 02:25 PM by Lee Kimber -- cgiphp module questioned
Added lines 28-33:

[Comment] Lee Is there a cgiphp module for Cherokee? Is there a cgiphp module at all?

I can't find one on this site and I can't find one in the Optware Cherokee package. I have been unable to get Cherokee to work with php on an Unslung NSLU2.

January 31, 2006, at 01:24 PM by RobHam -- Small textual change to the file permission settings section.
Changed lines 132-135 from:

Thttpd and File Permissions

Users of Thttpd and Php-Thttpd may find that they have difficulty loading some types of web page, this is most probably due to the file permissions settings. For a detailed discussion consult the web page :-

to:

Web Servers and File Permissions

Users of Thttpd, Php-Thttpd, Cherokee, Apache and other Optware web servers may find that they have difficulty serving some types of web page, in many cases this can be due to the individual file permissions settings. For a detailed discussion for the Thttpd server consult the web page :-

January 12, 2006, at 11:23 AM by RobHam -- Reference added to Cherokee Web server with cgiphp module.
Changed line 27 from:
  • IMPORTANT NOTE - The NSLU2's built in Thttpd web server does not support the PHP script language. Users that need this functionality should install one of the Optware Web Server packages such as the PHP enabled Php-Thttpd or Apache.
to:
  • IMPORTANT NOTE - The NSLU2's built in Thttpd web server does not support the PHP script language. Users that need this functionality should install one of the Optware Web Server packages such as the PHP enabled Php-Thttpd, Apache or Cherokee with the cgiphp module.
Changed line 157 from:
  1. Start by globaly flagging all files and directories with owner and group set to root
to:
  1. 1. Start by globaly setting all files and directories with owner and group set to root
Changed line 160 from:
  1. Then globaly flag all files and directories to permission 644
to:
  1. 2. Then globaly chmod all files and directories to permission 644
Changed line 163 from:
  1. Then flag all Directories to 2755
to:
  1. 3. Then chmod all Directories to permission 2755
Changed line 166 from:
  1. Finally flag all cgi files 755
to:
  1. 4. Finally search and chmod all cgi files to permission 755
January 08, 2006, at 01:26 PM by RobHam -- Files permission section converted to one script, chowm command added.
Changed lines 140-144 from:
  1. Flag all files and Directories with owner and group set to root
  2. Flag all Data files such as html and picture files - chmod 644
  3. Flag all Directories 2755
  4. Flag all CGI executables 755
to:
  1. Flag all files and Directories with owner and group set to - root
  2. Flag all Data files such as html and picture files - 644
  3. Flag all Directories - 2755
  4. Flag all CGI executables - 755
Changed lines 147-148 from:

Assume that the data files are stored in the folder structure /opt/share/www

to:

The following script section assumes that the data files are stored in the folder structure /opt/share/www/mywebpages - modify this directory name as required.

Changed line 158 from:

chown -R root:root /opt/share/www

to:

chown -R root:root /opt/share/www/mywebpages

Changed line 161 from:

chmod -R 0644 /opt/share/www

to:

chmod -R 0644 /opt/share/www/mywebpages

Changed line 164 from:

find /opt/share/www -type d -exec chmod 2755 {} \; -print

to:

find /opt/share/www/mywebpages -type d -exec chmod 2755 {} \; -print

Changed line 167 from:

find /opt/share/www -name *.cgi -exec chmod 0755 {} \; -print

to:

find /opt/share/www/mywebpages -name *.cgi -exec chmod 0755 {} \; -print

January 08, 2006, at 01:18 PM by RobHam -- Setting file and directory permissions section improved.
Changed lines 138-140 from:

For the NSLU2 suggest using the following rules

to:

Most of the working Web based Optware packages for the NSLU2 e.g. dokuwiki, mediawiki, phpmyadmin have adopted the following rules

  1. Flag all files and Directories with owner and group set to root
Changed line 142 from:
  1. Flag all Directories 755 or 2755
to:
  1. Flag all Directories 2755
Changed lines 149-150 from:

1. Start by globaly flagging all files and directories to permission 644. This is easily done using the command :-

to:

Login as user root.

Changed lines 153-160 from:

[=

to:
 [=
  1. ! /bin/sh
  2. Diversion script: to set file permissions for web pages and directories
  3. Start by globaly flagging all files and directories with owner and group set to root

chown -R root:root /opt/share/www

  1. Then globaly flag all files and directories to permission 644
Added lines 162-168:
  1. Then flag all Directories to 2755

find /opt/share/www -type d -exec chmod 2755 {} \; -print

  1. Finally flag all cgi files 755

find /opt/share/www -name *.cgi -exec chmod 0755 {} \; -print

Changed lines 172-190 from:

2. Then flag all Directories to 2755 (:table border=0 width=100% bgcolor=#eeeeff:) (:cell:) find /opt/share/www -type d -exec chmod 2755 {} \; -print (:tableend:)

3. Finally flag all cgi files 755 (:table border=0 width=100% bgcolor=#eeeeff:) (:cell:) find /opt/share/www -name *.cgi -exec chmod 0755 {} \; -print (:tableend:)

Hope that these script sections prove useful to users, I have used them to install Gallery2 which contains a massive directory structure, a virtually impossible task to flag each directory by hand with this download. Note that -print just displays the progress on the console screen so can be omitted from the script sections if required.

to:

Hope that these script sections prove useful to users. Note that -print just displays the progress on the console screen so can be omitted from the script sections if required.

January 06, 2006, at 05:11 PM by RobHam -- Added section on File Permission setting for large directory structures
Added lines 131-177:

Thttpd and File Permissions

Users of Thttpd and Php-Thttpd may find that they have difficulty loading some types of web page, this is most probably due to the file permissions settings. For a detailed discussion consult the web page :-

http://www.acme.com/software/thttpd/thttpd_man.html

For the NSLU2 suggest using the following rules

  1. Flag all Data files such as html and picture files - chmod 644
  2. Flag all Directories 755 or 2755
  3. Flag all CGI executables 755

It can prove quite difficult to flag large directory structures to these rules but the following script sections can be modified to cover most structures.

Assume that the data files are stored in the folder structure /opt/share/www

1. Start by globaly flagging all files and directories to permission 644. This is easily done using the command :-

(:table border=0 width=100% bgcolor=#eeeeff:) (:cell:) chmod -R 0644 /opt/share/www (:tableend:)

2. Then flag all Directories to 2755 (:table border=0 width=100% bgcolor=#eeeeff:) (:cell:) find /opt/share/www -type d -exec chmod 2755 {} \; -print (:tableend:)

3. Finally flag all cgi files 755 (:table border=0 width=100% bgcolor=#eeeeff:) (:cell:) find /opt/share/www -name *.cgi -exec chmod 0755 {} \; -print (:tableend:)

Hope that these script sections prove useful to users, I have used them to install Gallery2 which contains a massive directory structure, a virtually impossible task to flag each directory by hand with this download. Note that -print just displays the progress on the console screen so can be omitted from the script sections if required.

RobHam - Jan 2006

January 05, 2006, at 02:04 PM by RobHam -- Recommended home directory changed to /opt/share/www to be compatable with many http Optware packages
Changed line 4 from:
  1. Create a home directory for your web pages that you want shared: e.g. /opt/share/www is the recommended directory because it is compatable with some Optware packages.
to:
  1. Create a home directory for your web pages that you want shared: /opt/share/www is the recommended directory because it is compatable with many Optware packages.
Changed line 27 from:
  • The built in Thttpd web server does not support the PHP script language. Users that need this functionality should install one of the Optware Web Server packages such as Php-Thttpd or Apache.
to:
  • IMPORTANT NOTE - The NSLU2's built in Thttpd web server does not support the PHP script language. Users that need this functionality should install one of the Optware Web Server packages such as the PHP enabled Php-Thttpd or Apache.
January 05, 2006, at 01:55 PM by RobHam -- Recommended home directory changed to /opt/share/www to be compatable with some Optware packages
Changed line 4 from:
  1. Create a home directory for your web pages that you want shared: e.g. /share/flash/data/html or perhaps /share/hdd/data/public
to:
  1. Create a home directory for your web pages that you want shared: e.g. /opt/share/www is the recommended directory because it is compatable with some Optware packages.
January 01, 2006, at 04:01 PM by RobHam -- Note added regarding the Built in Web server and PHP support.
Added line 27:
  • The built in Thttpd web server does not support the PHP script language. Users that need this functionality should install one of the Optware Web Server packages such as Php-Thttpd or Apache.
October 10, 2005, at 06:29 PM by SPAZ -- fixed typo
Changed line 10 from:
  1. To open your web server to the internet open up incomming port 80 on your router and forward it to port 900 no your NSLU2, most routers allow port forwarding across ports, config page for this is often hidden away under UPNP forwarding.
to:
  1. To open your web server to the internet open up incomming port 80 on your router and forward it to port 900 on your NSLU2, most routers allow port forwarding across ports, config page for this is often hidden away under UPNP forwarding.
October 01, 2005, at 10:52 PM by Jelle -- added the chmod +x for init.d script
Changed lines 11-13 from:
  1. If you want your second web server instance to automaticaly start after a re-boot of the slug then create a startup file in the folder /opt/etc/init.d using a script such as echo "/opt/sbin/mythttpd -C /opt/etc/mythttpd.conf" > /opt/etc/init.d/S81mythttpd
to:
  1. If you want your second web server instance to automaticaly start after a re-boot of the slug then create a startup file in the folder /opt/etc/init.d using a script such as echo "/opt/sbin/mythttpd -C /opt/etc/mythttpd.conf" > /opt/etc/init.d/S81mythttpd. Note - don't forget to chmod +x /opt/etc/init.d/S81mythttpd.
August 13, 2005, at 09:03 AM by Martin J Hsu --
Changed lines 14-15 from:

A start up script that kills the existing instance and restart the server would look like other start up scripts (reboot not required to restart thttpd):

to:

A start up script that kills the existing instance and restart the server would look like other start up scripts (not requiring reboot to restart thttpd):

August 13, 2005, at 08:52 AM by Martin J Hsu -- added alternative start up script
Added lines 14-24:

A start up script that kills the existing instance and restart the server would look like other start up scripts (reboot not required to restart thttpd):

#!/bin/sh
if [ -n "`pidof mythttpd`" ]; then
killall mythttpd 2>/dev/null
fi
/opt/sbin/mythttpd -C /opt/etc/mythttpd.conf
July 18, 2005, at 12:23 PM by DougLourey --
Changed lines 12-13 from:

[DougLourey? - chmod 777 /opt/etc/init.d/S81mythttpd - Should the startup file be executable?]

to:
July 16, 2005, at 11:10 PM by DougLourey --
Added line 13:
July 16, 2005, at 11:09 PM by DougLourey --
Changed line 12 from:
to:

[DougLourey? - chmod 777 /opt/etc/init.d/S81mythttpd - Should the startup file be executable?]

May 25, 2005, at 08:54 PM by RobHam --
Changed line 6 from:
  1. Copy and rename the thttpd config file cp /etc/thttpd.conf /opt/etc/mythttpd.conf then edit /opt/etc/mythttpd.conf using a text editor such as vi changing the port number, home directory, log file to mythttpd.log and pid file to mythttpd.pid
to:
  1. Copy and rename the thttpd config file cp /etc/thttpd.conf /opt/etc/mythttpd.conf then edit /opt/etc/mythttpd.conf using a text editor such as vi changing the port number, home directory, log file to logfile=/opt/var/log/mythttpd.log and pid file to pidfile=/opt/var/run/mythttpd.pid
May 25, 2005, at 08:38 PM by RobHam --
Deleted line 7:
  1. You can check that the second server is running on your lan using http://192.168.1.77:900 - this assumes that your second server is running on port 900 and the default Slug IP address.
Added line 9:
  1. You can check that the second server is running on your lan using http://192.168.1.77:900 - this assumes that your second server is running on port 900 and the default Slug IP address. Note that the server software expects an index.html file to be present in the home folder to work correctly.
May 25, 2005, at 07:15 PM by RobHam --
Changed line 8 from:
  1. You can check that the second server is running on your lan using http://192.168.1.77:900 - this assumes that your second server is running on port 900 and the default Slug IP address.
to:
  1. You can check that the second server is running on your lan using http://192.168.1.77:900 - this assumes that your second server is running on port 900 and the default Slug IP address.
Changed lines 60-61 from:
  1. symlinkcheck <-- docs say this should be used from v 2.24 onwards, but they seem to be wrong
  2. nosymlinkcheck <-- docs say this should be used from v 2.24 onwards, but they seem to be wrong
to:
  1. symlinkcheck <-- docs say this should be used from v 2.24 onwards,
  2. but they seem to be wrong
  3. nosymlinkcheck <-- docs say this should be used from v 2.24 onwards,
  4. but they seem to be wrong
May 25, 2005, at 06:49 PM by RobHam -- Page instructions expanded
Changed lines 1-10 from:

If you want to use the existing built-in thttpd for your personal web-server, you can. The exact procedure will vary depending upon the firmware you are using, but here are the basic steps:

  1. Set your admin web port to something other than 80 (e.g. 8080). I do this so that there aren't conflicts with the existing web server instance. This change must be done through the standard Linksys configuration page (last option on the Administration-->System page). If you just try to change the setting in the thttpd.conf file, it will be overwritten at boot.
  2. Create a directory that you want shared: (e.g. /share/flash/data/html)
  3. copy and edit /etc/thttpd.conf. Make sure you set the port # to 80.
  4. (NEW STEP) copy and rename thttpd (e.g. cp /usr/sbin/thttpd /opt/mythttpd)
  5. launch your new (secondary) web server: /opt/mythttpd -C <new config file>
  6. put your web pages in the directory you created above.
  7. Open up port 80 on your router and forward it to your NSLU2
to:

If you want to use the existing built-in thttpd for your personal web-server, you can by running a second instance of the server under a different program name (to avoid any conflicts) and on a seperate port. The exact procedure will vary depending upon the firmware you are using, but here are the basic steps:

  1. If you intend running your second server on port 80 then set your existing admin web port to something other than 80 (e.g. 8080). This change must be done through the standard Linksys configuration page (last option on the Administration-->System page). If you just try to change the setting in the thttpd.conf file, it will be overwritten at boot. Note - Recommend setting the port number for your second server to an un-used high port number such as 900.
  2. Create a home directory for your web pages that you want shared: e.g. /share/flash/data/html or perhaps /share/hdd/data/public
  3. Copy and rename the thttpd executable cp /usr/sbin/thttpd /opt/sbin/mythttpd
  4. Copy and rename the thttpd config file cp /etc/thttpd.conf /opt/etc/mythttpd.conf then edit /opt/etc/mythttpd.conf using a text editor such as vi changing the port number, home directory, log file to mythttpd.log and pid file to mythttpd.pid
  5. To launch your new (secondary) web server use: /opt/sbin/mythttpd -C /opt/etc/mythttpd.conf
  6. You can check that the second server is running on your lan using http://192.168.1.77:900 - this assumes that your second server is running on port 900 and the default Slug IP address.
  7. Put your web pages in the directory you created above.
  8. To open your web server to the internet open up incomming port 80 on your router and forward it to port 900 no your NSLU2, most routers allow port forwarding across ports, config page for this is often hidden away under UPNP forwarding.
  9. If you want your second web server instance to automaticaly start after a re-boot of the slug then create a startup file in the folder /opt/etc/init.d using a script such as echo "/opt/sbin/mythttpd -C /opt/etc/mythttpd.conf" > /opt/etc/init.d/S81mythttpd
Changed line 16 from:
  • You may want to enable chroot (in the thttpd.conf file) for security purposes, and set your uid to nobody.
to:
  • You may want to enable chroot (in the mythttpd.conf file) for security purposes, and set your uid to nobody.
Changed lines 24-29 from:

A fully commented conf file /opt/etc/thttpd.conf you can use:

to:

A fully commented conf file /opt/etc/thttpd.conf to refer to:

(:table border=0 width=100% bgcolor=#eeeeff:) (:cell:)

 [= 
  1. Configuration file for thttpd (defined for NSLU2 ipkg thttpdphp)
Changed lines 31-32 from:
 # Configuration file for thttpd (defined for NSLU2 ipkg thttpdphp)
to:
  1. Specifies an alternate port number to listen on. The default is 80.

port=80

Changed lines 34-35 from:
 # Specifies an alternate port number to listen on. The default is 80.
 port=80
to:
  1. Specifies a directory to chdir() to at startup. This is merely a convenience
  2. you could just as easily do a cd in the shell script that invokes the program.

dir=/opt/share/www

Changed lines 38-40 from:
 # Specifies a directory to chdir() to at startup. This is merely a convenience 
 # you could just as easily do a cd in the shell script that invokes the program.
 dir=/opt/share/www
to:
  1. Specifies what user to switch to after initialization when started as root.
  2. The default is "nobody"

user=nobody

Changed lines 42-44 from:
 # Specifies what user to switch to after initialization when started as root. 
 # The default is "nobody"
 user=nobody
to:
  1. Do a chroot() at initialization time, restricting file access to the program's
  2. current directory.

nochroot

  1. chroot=
Changed lines 47-50 from:
 # Do a chroot() at initialization time, restricting file access to the program's 
 # current directory.
 nochroot
 #chroot=
to:
  1. Specifies a directory to chdir() to after chrooting. If you're not chrooting,
  2. you might as well do a single chdir(). If you are chrooting, this lets you put
  3. the web files in a subdirectory of the chroot tree, instead of in the top level
  4. mixed in with the chroot files.
  5. datadir=
Changed lines 53-57 from:
 # Specifies a directory to chdir() to after chrooting. If you're not chrooting, 
 # you might as well do a single chdir(). If you are chrooting, this lets you put 
 # the web files in a subdirectory of the chroot tree, instead of in the top level 
 # mixed in with the chroot files.
 #datadir=
to:
  1. Don't do explicit symbolic link checking. Normally, thttpd explicitly expands
  2. any symbolic links in filenames, to check that the resulting path stays within
  3. the original document tree. If you want to turn off this check and save some
  4. CPU time, you can use this option, however this is not recommended.
  5. Note, though, that if you are using the chroot option, the symlink checking is
  6. unnecessary and is turned off, so the safe way to save those CPU cycles is to
  7. use chroot.
  8. symlinkcheck <-- docs say this should be used from v 2.24 onwards, but they seem to be wrong
  9. nosymlinkcheck <-- docs say this should be used from v 2.24 onwards, but they seem to be wrong
  10. symlink

nosymlink

Changed lines 65-75 from:
 # Don't do explicit symbolic link checking. Normally, thttpd explicitly expands 
 # any symbolic links in filenames, to check that the resulting path stays within 
 # the original document tree. If you want to turn off this check and save some 
 # CPU time, you can use this option, however this is not recommended. 
 # Note, though, that if you are using the chroot option, the symlink checking is 
 # unnecessary and is turned off, so the safe way to save those CPU cycles is to 
 # use chroot. 
 #symlinkcheck   <-- docs say this should be used from v 2.24 onwards, but they seem to be wrong
 #nosymlinkcheck <-- docs say this should be used from v 2.24 onwards, but they seem to be wrong
 #symlink
 nosymlink
to:
  1. Do el-cheapo virtual hosting. This sends each incoming request to a subdirectory
  2. based on the hostname it's intended for. All you have to do in order to set things
  3. up is to create those subdirectories in the directory where thttpd will run.
  4. novhost

vhost

Changed lines 71-75 from:
 # Do el-cheapo virtual hosting. This sends each incoming request to a subdirectory 
 # based on the hostname it's intended for. All you have to do in order to set things
 # up is to create those subdirectories in the directory where thttpd will run.
 #novhost
 vhost
to:
  1. Use a global passwd file. This means that every file in the entire document tree
  2. is protected by the single .htpasswd file at the top of the tree. Otherwise the
  3. semantics of the .htpasswd file are the same. If this option is set but there is
  4. no .htpasswd file in the top-level directory, then thttpd proceeds as if the option
  5. was not set - first looking for a local .htpasswd file, and if that doesn't exist
  6. either then serving the file without any password.
  7. globalpasswd
  8. noglobalpasswd
Changed lines 80-87 from:
 # Use a global passwd file. This means that every file in the entire document tree 
 # is protected by the single .htpasswd file at the top of the tree. Otherwise the 
 # semantics of the .htpasswd file are the same. If this option is set but there is 
 # no .htpasswd file in the top-level directory, then thttpd proceeds as if the option 
 # was not set - first looking for a local .htpasswd file, and if that doesn't exist 
 # either then serving the file without any password. 
 #globalpasswd
 #noglobalpasswd
to:
  1. Specifies what user to switch to after initialization when started as root.
  2. The default is "nobody".
  3. user=
Changed lines 84-86 from:
 # Specifies what user to switch to after initialization when started as root. 
 # The default is "nobody".
 #user=
to:
  1. Specifies a wildcard pattern for CGI programs, for instance "**.cgi" or "/cgi-bin/*".
  2. cgipat=
Changed lines 87-88 from:
 # Specifies a wildcard pattern for CGI programs, for instance "**.cgi" or "/cgi-bin/*". 
 #cgipat=
to:
  1. Specifies a file of throttle settings.
  2. throttles=
Changed lines 90-91 from:
 # Specifies a file of throttle settings.
 #throttles=
to:
  1. Specifies a hostname to bind to, for multihoming. The default is to bind to all
  2. hostnames supported on the local machine.
  3. host=
Changed lines 94-96 from:
 # Specifies a hostname to bind to, for multihoming. The default is to bind to all 
 # hostnames supported on the local machine. 
 #host=
to:
  1. Specifies a file for logging. If no -l argument is specified, thttpd logs via
  2. syslog(). If "-l /dev/null" is specified, thttpd doesn't log at all.

logfile=/var/log/thttpd.log

Changed lines 98-100 from:
 # Specifies a file for logging. If no -l argument is specified, thttpd logs via 
 # syslog(). If "-l /dev/null" is specified, thttpd doesn't log at all.
 logfile=/var/log/thttpd.log
to:
  1. Specifies a file to write the process-id to. If no file is specified,
  2. no process-id is written. You can use this file to send signals to thttpd.

pidfile=/var/run/thttpd.pid

Changed lines 102-104 from:
 # Specifies a file to write the process-id to. If no file is specified, 
 # no process-id is written. You can use this file to send signals to thttpd.
 pidfile=/var/run/thttpd.pid
to:
  1. Specifies the character set to use with text MIME types. The default is iso-8859-1.
  2. charset=
Changed lines 105-106 from:
 # Specifies the character set to use with text MIME types. The default is iso-8859-1. 
 #charset=
to:
  1. Specifies a P3P? server privacy header to be returned with all responses.
  2. See http://www.w3.org/P3P/ for details. Thttpd doesn't do anything at all with the
  3. string except put it in the P3P?: response header.
  4. p3p=
Changed lines 110-118 from:
 # Specifies a P3P? server privacy header to be returned with all responses. 
 # See http://www.w3.org/P3P/ for details. Thttpd doesn't do anything at all with the 
 # string except put it in the P3P?: response header. 
 #p3p=

 # Specifies the number of seconds to be used in a "Cache-Control: max-age" header to 
 # be returned with all responses. An equivalent "Expires" header is also generated. 
 # The default is no Cache-Control or Expires headers, which is just fine for most sites. 
 #max_age=
to:
  1. Specifies the number of seconds to be used in a "Cache-Control: max-age" header to
  2. be returned with all responses. An equivalent "Expires" header is also generated.
  3. The default is no Cache-Control or Expires headers, which is just fine for most sites.
  4. max_age=

=] (:tableend:)

April 16, 2005, at 11:29 AM by MattMcNeill --
Changed line 27 from:
 port=9090
to:
 port=80
Added lines 33-34:
 # Specifies what user to switch to after initialization when started as root. 
 # The default is "nobody"
Changed lines 55-56 from:
 #symlinkcheck
 nosymlinkcheck
to:
 #symlinkcheck   <-- docs say this should be used from v 2.24 onwards, but they seem to be wrong
 #nosymlinkcheck <-- docs say this should be used from v 2.24 onwards, but they seem to be wrong
 #symlink
 nosymlink
Changed lines 63-64 from:
 novhost
 #vhost
to:
 #novhost
 vhost
Changed line 80 from:
 #cgipat= 
to:
 #cgipat=
Changed line 84 from:
to:
Changed line 95 from:
 pidfile=/var/run/thttpd.pid 
to:
 pidfile=/var/run/thttpd.pid
Deleted lines 108-111:
April 16, 2005, at 10:59 AM by MattMcNeill --
Changed lines 21-108 from:
to:

A fully commented conf file /opt/etc/thttpd.conf you can use:

 # Configuration file for thttpd (defined for NSLU2 ipkg thttpdphp)

 # Specifies an alternate port number to listen on. The default is 80.
 port=9090

 # Specifies a directory to chdir() to at startup. This is merely a convenience 
 # you could just as easily do a cd in the shell script that invokes the program.
 dir=/opt/share/www

 user=nobody

 # Do a chroot() at initialization time, restricting file access to the program's 
 # current directory.
 nochroot
 #chroot=

 # Specifies a directory to chdir() to after chrooting. If you're not chrooting, 
 # you might as well do a single chdir(). If you are chrooting, this lets you put 
 # the web files in a subdirectory of the chroot tree, instead of in the top level 
 # mixed in with the chroot files.
 #datadir=

 # Don't do explicit symbolic link checking. Normally, thttpd explicitly expands 
 # any symbolic links in filenames, to check that the resulting path stays within 
 # the original document tree. If you want to turn off this check and save some 
 # CPU time, you can use this option, however this is not recommended. 
 # Note, though, that if you are using the chroot option, the symlink checking is 
 # unnecessary and is turned off, so the safe way to save those CPU cycles is to 
 # use chroot. 
 #symlinkcheck
 nosymlinkcheck

 # Do el-cheapo virtual hosting. This sends each incoming request to a subdirectory 
 # based on the hostname it's intended for. All you have to do in order to set things
 # up is to create those subdirectories in the directory where thttpd will run.
 novhost
 #vhost

 # Use a global passwd file. This means that every file in the entire document tree 
 # is protected by the single .htpasswd file at the top of the tree. Otherwise the 
 # semantics of the .htpasswd file are the same. If this option is set but there is 
 # no .htpasswd file in the top-level directory, then thttpd proceeds as if the option 
 # was not set - first looking for a local .htpasswd file, and if that doesn't exist 
 # either then serving the file without any password. 
 #globalpasswd
 #noglobalpasswd

 # Specifies what user to switch to after initialization when started as root. 
 # The default is "nobody".
 #user=

 # Specifies a wildcard pattern for CGI programs, for instance "**.cgi" or "/cgi-bin/*". 
 #cgipat= 

 # Specifies a file of throttle settings.
 #throttles=

 # Specifies a hostname to bind to, for multihoming. The default is to bind to all 
 # hostnames supported on the local machine. 
 #host=

 # Specifies a file for logging. If no -l argument is specified, thttpd logs via 
 # syslog(). If "-l /dev/null" is specified, thttpd doesn't log at all.
 logfile=/var/log/thttpd.log

 # Specifies a file to write the process-id to. If no file is specified, 
 # no process-id is written. You can use this file to send signals to thttpd.
 pidfile=/var/run/thttpd.pid 

 # Specifies the character set to use with text MIME types. The default is iso-8859-1. 
 #charset=

 # Specifies a P3P? server privacy header to be returned with all responses. 
 # See http://www.w3.org/P3P/ for details. Thttpd doesn't do anything at all with the 
 # string except put it in the P3P?: response header. 
 #p3p=

 # Specifies the number of seconds to be used in a "Cache-Control: max-age" header to 
 # be returned with all responses. An equivalent "Expires" header is also generated. 
 # The default is no Cache-Control or Expires headers, which is just fine for most sites. 
 #max_age=
March 31, 2005, at 09:05 PM by Bill --
Changed line 3 from:
  1. Set your admin web port to something other than 80 (e.g. 8080). I do this so that there aren't conflicts with the existing web server instance.
to:
  1. Set your admin web port to something other than 80 (e.g. 8080). I do this so that there aren't conflicts with the existing web server instance. This change must be done through the standard Linksys configuration page (last option on the Administration-->System page). If you just try to change the setting in the thttpd.conf file, it will be overwritten at boot.
Changed line 20 from:
  • [Beewoolie] With the unslung firmware (3.1.8), there is a hitch to making these changes. There seems to be a process in the startup that copies configuration files into /etc/rc and /etc/rc.d. One of the victims is the thttpd configuration and startup script. Fortunately, /etc/rc.d/rc.1 is not one of them. So, I copied the /etc/thttpd.conf configuration to /etc/athttpd.conf (for admin) and changed the port to 8080. I then modified rc.1 to start the /etc/rc.d/rc.athttpd script instead of the /etc/rc.d/rc.thttpd.
to:
February 14, 2005, at 12:39 AM by beewoolie --
Added lines 20-21:
  • [Beewoolie] With the unslung firmware (3.1.8), there is a hitch to making these changes. There seems to be a process in the startup that copies configuration files into /etc/rc and /etc/rc.d. One of the victims is the thttpd configuration and startup script. Fortunately, /etc/rc.d/rc.1 is not one of them. So, I copied the /etc/thttpd.conf configuration to /etc/athttpd.conf (for admin) and changed the port to 8080. I then modified rc.1 to start the /etc/rc.d/rc.athttpd script instead of the /etc/rc.d/rc.thttpd.
November 08, 2004, at 04:55 AM by michaelebrownmindspringcom --
Changed line 19 from:
to:
November 08, 2004, at 04:54 AM by michaelebrownmindspringcom --
Added line 19:
November 08, 2004, at 04:54 AM by michaelebrownmindspringcom --
Changed line 19 from:
to:
September 21, 2004, at 04:33 PM by ka6sox --
Changed line 1 from:

If you want to use the existing built-in thttpd for your personal web-server, you can. The exact procedure will vary depending upon the firmware you are using, but here are the basic steps.

to:

If you want to use the existing built-in thttpd for your personal web-server, you can. The exact procedure will vary depending upon the firmware you are using, but here are the basic steps:

September 18, 2004, at 08:51 PM by mrthreeplates --
Changed lines 6-7 from:
  1. launch your new (secondary) web server: /usr/sbin/thttpd -C <new config file>
to:
  1. (NEW STEP) copy and rename thttpd (e.g. cp /usr/sbin/thttpd /opt/mythttpd)
  2. launch your new (secondary) web server: /opt/mythttpd -C <new config file>
Changed lines 17-18 from:
  • You may want to edit the WatchDog? script to ignore/handle the second thttpd instance gracefully.
  • A clean build of a newer version of thttpd would be a better solution, but this works and is easy.
to:
  • Renaming of the thttpd binary is needed to allow the /usr/sbin/WatchDog script to work correctly.
  • A clean build of a newer version of thttpd would be a better solution, but this works and is easy.
September 17, 2004, at 06:58 PM by Pete Verdon --
Deleted line 10:
 There seems to be some built-in code for browsing empty directories, so you may want to make sure you always have an index.htm file.
Changed lines 12-20 from:
 You may want to enable chroot (in the thttpd.conf file) for security purposes, and set your uid to nobody.

 See the man page of thttpd on the net for more info on command line options and config file options:

 http://www.acme.com/software/thttpd/thttpd_man.html

 You may want to edit the WatchDog? script to ignore/handle the second thttpd instance gracefully.

 A clean build of a newer version of thttpd would be a better solution, but this works and is easy.
to:
  • There seems to be some built-in code for browsing empty directories, so you may want to make sure you always have an index.htm file.
  • You may want to enable chroot (in the thttpd.conf file) for security purposes, and set your uid to nobody.
  • See the man page of thttpd on the net for more info on command line options and config file options:
http://www.acme.com/software/thttpd/thttpd_man.html
  • You may want to edit the WatchDog? script to ignore/handle the second thttpd instance gracefully.
  • A clean build of a newer version of thttpd would be a better solution, but this works and is easy.
September 16, 2004, at 07:41 AM by mrthreeplates --
Changed lines 1-21 from:

Describe UsingThttpdWebserver? here.

to:

If you want to use the existing built-in thttpd for your personal web-server, you can. The exact procedure will vary depending upon the firmware you are using, but here are the basic steps.

  1. Set your admin web port to something other than 80 (e.g. 8080). I do this so that there aren't conflicts with the existing web server instance.
  2. Create a directory that you want shared: (e.g. /share/flash/data/html)
  3. copy and edit /etc/thttpd.conf. Make sure you set the port # to 80.
  4. launch your new (secondary) web server: /usr/sbin/thttpd -C <new config file>
  5. put your web pages in the directory you created above.
  6. Open up port 80 on your router and forward it to your NSLU2

Notes:

 There seems to be some built-in code for browsing empty directories, so you may want to make sure you always have an index.htm file.

 You may want to enable chroot (in the thttpd.conf file) for security purposes, and set your uid to nobody.

 See the man page of thttpd on the net for more info on command line options and config file options:

 http://www.acme.com/software/thttpd/thttpd_man.html

 You may want to edit the WatchDog? script to ignore/handle the second thttpd instance gracefully.

 A clean build of a newer version of thttpd would be a better solution, but this works and is easy.
Page last modified on December 13, 2010, at 04:00 AM