27.5 Setting up your Server
The configuration file can be found in the conf directory. There is an example file you can use, httpd.conf-dist, to create your server configuration file, httpd.conf.
Some of the entries you'll want to check out are:
ServerType standalone or inetd
The latter determines the directory hierarchy for your service. It could have sub-directories such as: cgi-bin, conf, htdocs, icons, and logs.
This is a service you don't want to run as root, so you should create a special user and group just for it. So in /etc/passwd you might have an entry similar to:
http:nologin:999:999:World Wide Web Server:/usr/local/http:/bin/false
and a /etc/group entry similar to:
You can run your server either as a standalone server, in which case you would start it up in an RC script, or as a service controlled by inetd. In the latter case you would need an entry in /etc/services similar to:
http 80/tcp # WWW server
and another in /etc/inetd.conf similar to:
http stream tcp nowait http /usr/local/etc/httpd -d /usr/local/httpd -f /usr/local/httpd/conf/httpd.conf
-d specifies the ServerRoot and where the daemon will look for it's configuration file (not necessary if you use the default ServerRoot path in the configuration file.)
-f specifies the configuration file
To set it up as a standalone server you might put an entry similar to the following in an RC script, e.g. /etc/rc.local for SunOS 4.1.X:
if [ -f /usr/local/etc/httpd -a -d /usr/local/httpd -a -f /usr/local/httpd/conf/httpd.conf ]; then
/usr/local/etc/httpd -d /usr/local/httpd -f /usr/local/httpd/conf/httpd.conf; echo -n ' httpd'
For SunOS 5.X set up a script to start and stop the service as you go through run level 2.
Running httpd as a standalone daemon is more efficient, but running as a service of inetd provides greater access control. If you're using TCPwrapper you can specify which machines or subnets have access to your http service when each connection is controlled by inetd.