W3C httpd manual

Command Line of W3C httpd

The command line syntax for httpd allows a number of options and an optional directory argument:
        httpd  [-opt -opt -opt ...] [directory]
The directory argument, if present, indicates the directory to be exported. If not present, either a rule file is be used, to export combinations of directories, or else the default is to export the /Public directory tree.

Note: When the directory parameter is given, the configuration file is not loaded. Use of directory parameter is discouraged - the configuration file is necessary in most of the cases today.


-r rulefile
Use rulefile as configuration file. This is the only necessary command line option if you don't have the default configuration file, /etc/httpd.conf. All the other options can be given as directives in the configuration file.
-p port
Listen to port port. Without this argument httpd assumes that it has been run by inetd, and uses stdin and stdout as its communication channel. Note that port numbers under 1024 are privileged.
-l logfile
Use logfile to log the requests.
Restart an already running httpd. httpd finds the out the process number of the running server from PidFile and sends it the HUP signal (HangUP). This will cause httpd to reload its configuration files and reopen its log files. Important: To find out the PidFile httpd will have to read the same configuration file as the running httpd has, so you have to specify the same -r options on the command line as for the actual httpd.
[only for proxies] Do only garbage collection and then exit. This can be used to run httpd periodically by cron to do garbage collection on a cache that is used by httpd run from the inetd daemon rather than standalone. When httpd is not running standalone it cannot monitor the cache, nor perform automatic garbage collection.
Verbose, turn on debugging messages.
Very Verbose, turn on even more verbose debugging messages.
Print version number of httpd and libwww (the WWW Common Library).

Directory Browsing

You can set these also with the DirAccess configuration directive.
Enable direcory browsing. Directories are returned as hypertext documents. See browsing directories. Default.
Disable directory browsing. An attempt to access a directory will generate an error response.
Selective directory browsing; enabled only for directories containing a file named .www_browsable

README Feature

It is common practice to put a file named README into a directory containing instructions or notices to be read by anyone new to the directory. httpd will by default embed any README file in the hypertext version of a directory.

You can set these also with the DirReadme configuration directive.

For any browsable directory which contains a README file, include the text of the README file at the top of the document before the listing. Default.
As -dt but put the README at the bottom, after the listing. The -db and -dt options may be combined with -dy as -dyb, -dty etc.
Disables the README inclusion feature.


        httpd -r /usr/etc/httpd.conf -p 80
This is a standalone server running on port 80. Configuration file is /usr/etc/httpd.conf instead of the default, /etc/httpd.conf.

Note that if the Port directive is given in the configuration file the -p option is not necessary (it can be used to override the value set in the configuration file).

httpd uses its default configuration file /etc/httpd.conf. If that file doesn't exist, httpd exports the /Public directory tree. This tree may contain soft links to other directory trees.

If the configuration file /etc/httpd.conf didn't define the port number to listen to this is an httpd reading its stdin and writing to its stdout, so it is run by inetd.

        httpd -r /usr/local/lib/httpd.conf
The same as before, but uses /usr/local/lib/httpd.conf as a rule file instead of the default /etc/httpd.conf.