Home   Info   Documentation   Installation   Configuration   History   Download   Mailing list   Feedback 

Installation

Unpacking

fhttpd is distributed in sources using standard Unix tar file with GNU gzip compression. To unpack the file you need a Unix or GNU tar and GNU gzip programs. The command line is

gzip -dc fhttpd-0.4.0.tar.gz | tar xvf -

although with GNU tar the command line

tar xvzf fhttpd-0.4.0.tar.gz

will work, too. If tar or gzip or shell gives you an error message instead of a file list, check if you have all necessary utilities and have received the archive file properly. GNU gzip and tar as well as the gcc compiler can be found at prep.ai.mit.edu in /pub/gnu directory.

Directory fhttpd-0.4.0 and the source tree under it will be created. cd to that directory.

Configuring Makefile

Edit Makefile. You may need to change some lines to make fhttpd work on your system, although at this time I can't provide more comprehensive information here. Configuration options for Linux-glibc, FreeBSD, SunOS, AIX and IRIX are commented in the distribution Makefile, and most of other systems use similar sets of them. Note that Linux section works with Linux glibc 2 (libc 6), and there is separate section for Linux with libc 5.

Compiling

You need to have C and C++ compilers that are mentioned in the Makefile installed. I used IBM xlc on AIX 4.x, Sun C++ compiler on Solaris and gcc on all other platforms, although I expect other compilers to work with this source.

Type

make

and fhttpd will be built.

If you will see any errors, it may be a problem with options, compiler or installed libraries. Please note that on Linux fhttpd won't work if compiled with some old, buggy versions of glibc2 (<=2.0.6) that probably are still in use somewhere.

System configuration

You have to be the root user to do everything in this step - use su command.

Before starting fhttpd you may need to stop and/or remove your existing FTP and/or HTTP daemons. Most systems have FTP daemon ftpd defined in the inetd configuration file /etc/inetd.conf. If you are going to use fhttpd as an FTP server, edit that file and comment out the line mentioning "ftp". Then exit from the editor and reconfigure inetd. by using the command

kill -HUP `cat /var/run/inetd.pid`

or "kill -HUP" its process id, found with ps if your system does not support the /var/run/inetd.pid file. You may need to change system startup files or /etc/inetd.conf and/or kill some processes to remove other FTP or HTTP daemons.

fhttpd can coexist with other FTP and HTTP daemons if different ports are assigned for the same protocol to different daemons.

Earlier versions of fhttpd required to be used as both FTP and HTTP server, although since version 0.3.0 it's possible to disable fhttpd functionality as FTP or HTTP server by defining corresponding ports in configuration file as 0.

fhttpd configuration for running as a regular user

fhttpd can run as a regular user. It will allow only access to files/scripts under its userid, and it will require server to use a nonprivileged port. Since it uses "ftp" user for anonymous FTP, running server as other than "ftp" user will make the use of anonymous FTP impossible, and non-anonymous FTP will be still limited to that userid. However module processes that use TCP/IP connection to the main server can access this server and serve requests through it while running under other userids on the same or different host. This mode is not intended for anything other than creating limited-access environment, handled by a single user, or testing.

To make the default configuration just unpack in the fhttpd directory the http-root.tar file, cd to created http-root directory and run makeconfig.sh file to make fhttpd.conf. Then start runserver.sh, and unless ports 9000 and 9001 are already used, it will start as an HTTP server on the port 9000. Port 9001 will be used for processes connections.

The startup message will look like:

Fri Sep  5 04:45:52 1997[5420] fhttpd started, process 5420
Fri Sep  5 04:45:53 1997[5420] Wheel::Wheel: 256 handles available
Fri Sep  5 04:45:53 1997[5420] FTP/HTTP daemon started
Fri Sep  5 04:45:53 1997[5418] Server is running

(of course, the process ids will be different). Note that two process IDs are mentioned -- first lines show the daemon pid, last line has the process ID of the process that launched the daemon and exited. In fhttpd 0.3.0 that process returns 0 only if the daemon started successfully, or otherwise displays error messages and exits with nonzero return value.

Log will be written into fhttpd.log file that can be monitored using

tail -f fhttpd.log

fhttpd configuration for running as root

You have to be the root user to do everything in this step - use su command.

Copy fhttpd.conf file to /etc/fhttpd.conf and edit it. The table of keywords is here.

Users and directories configuration

You have to be the root user to do everything in this step - use su command.

Default configuration assumes that user ftp exists on the system, and his home directory is /home/ftp. If you don't already have configured directory tree, copy all files and directories from http-root directory into /home/ftp (or whatever is defined as the default HTTP root directory). Change the ownership of the incoming directory to the ftp user, and change group of private directory to some group that should not contain regular users who don't have permission to use this directory, but contains HTTP user. Also files under private directory should be readable (or readable and executable) for that group or user. The result must be similar to:


total 8
drwxr-xr-x   2 root     root         1024 Sep  2 04:51 bin/
drwxr-xr-x   2 root     root         1024 Sep  2 04:50 cgi-bin/
drwxr-xr-x   2 root     root         1024 Jul 30  1995 icons/
drwx------   2 ftp      root         1024 Jul 30  1995 incoming/
-rw-r--r--   1 root     root          713 Sep  2 05:10 index.html
-rw-r--r--   1 root     root          323 Sep  2 04:44 noaccess.html
drwxr-x---   2 root     ftp          1024 Jul 30  1995 private/
drwxr-xr-x   3 root     root         1024 Jul 30  1995 pub/

Copy any number of entries from /etc/passwd file or other password database to /etc/passwd.http_users -- those users will have access to "restricted" directories and files.

Copy fhttpd, fhttpd-log and fhttpd-file executables into their final location (most likely /usr/local/sbin). The configuration file should contain the complete pathname of fhttpd-file in the default "*" Application entry and the complete pathname of fhttpd-log in LogApplication entry.

fhttpd uses Special files and URLs for directory listings -- the mechanism is different from other servers, however usual index.html works as usual with some exceptions. Please note that by default it's possible to get listing of any directory, and it can be disabled by defining rules that disallow it.

Starting fhttpd as root

You have to be the root user to do everything in this step - use su command.

Just start fhttpd. It will show messages:


Fri Sep  5 03:42:33 1997[5139] fhttpd started, process 5139
Fri Sep  5 03:42:34 1997[5139] Wheel::Wheel: 256 handles available
Fri Sep  5 03:42:34 1997[5139] FTP/HTTP daemon started
Fri Sep  5 03:42:34 1997[5137] Server is running

(see the comment for running fhttpd as a regular user).

You can monitor log messages in the log file (/tmp/fhttpd-log.log by default) using something like

tail -f /tmp/fhttpd-log.log

You may need to restart fhttpd if you have made changes in /etc/fhttpd.conf file, although

kill -USR1 `cat /var/run/fhttpd.pid`

may be used to reload passwords without changing other configuration parameters, and

kill -HUP `cat /var/run/fhttpd.pid`

will reload the configuration completely.

If you have installed fhttpd correctly, root page of your site will look like this.

Adding fhttpd to system start-up scripts

You have to be the root user to do everything in this step - use su command.

Add fhttpd to one of system start-up scripts, /etc/inittab, or whatever you use for that purpose. Make sure that fhttpd is started after base TCP/IP configuration is complete and DNS is available.

PHP3 installation

You have to be the root user to do everything in this step - use su command.

While PHP3 is neither specific for fhttpd, nor is necessary for its basic functionality, it can be helpful. PHP is HTML-embedded scripting language, and it can be compiled as fhttpd module.

Download and configure PHP3. When setup script asks to compile as Apache module, answer "no", and when it will ask to compile as fhttpd module, answer "yes". I will ask for fhttpd sources directory, enter the directory, where fhttpd was compiled. Configure installation directory to some value (say, /usr/local/sbin and use that value in fhttpd configuration (see below). Make php executable and install it -- it will be placed in the installation directory. As opposed to standard php, when started it will return:


Usage: /usr/local/sbin/php [options] [appname] [username] [hostname] [portname]
Options:
  -d       Daemon mode -- never attempt terminal I/O
  -s       Socket mode, fhttpd internal use only
  -p       Pipe mode, fhttpd internal use only
  -u<mask> Set umask
  -t<time> Idle timeout in seconds, 0 - disable
  -S       Display colour syntax highlighted source
  -P       Make and execute a pretokenized script
           (.php3p file) or, if pretokenized script, newer
           than original file exists, execute it instead
  -E       Execute a pretokenized (.php3p) script
  -c<path> Look for php3.ini file in this directory
           (must appear before any other options)
  -v       Version number
  -h       This help

Add php as a module for *.php3 mask. The line in the example configuration file is:

Application php3 - ftp 3000,30 1 *.php3 /usr/local/sbin/php -s

"php3" is an application name, "-" means that trailing slash is irrelevant, "ftp" is a username, used by default, 3000 is instances limit, 30 is instances limit per userid, "*.php3" is a mask, "/usr/local/sbin/php -s" is a command line (directory is a directory where php is installed), and "-s" is an option, recognized by both php and fhttpd -- it means that AF_UNIX socket is used for communication.

That line should be placed before the default "Application" line (in the default configuration it has fhttpd-file module). Default "Application" line must always be left the last "Application" or "AuthApplication" line in the configuration file because it has mask "*" and matches every possible pathname.


 Home   Info   Documentation   Installation   Configuration   History   Download   Mailing list   Feedback