The http (Hyper Text Transfer Protocol) daemon (port 80)would have to be one of the most important
daemon services, no httpd (http daemon) no internet. The most common & popular httpd is Apache.
Apache has a huge market share, surveys have shown that around 60% of all the web sites on the internet
are being served by Apache, making Apache THE most popular web server software & best of all it’s free :o).
Apache is very powerful but also quiet flexible, enabling you to configure & scale the web server to suit your needs.
Although Apache has a huge configuration file (usually found under /etc/httpd/http.conf) there are relatively few
things that have to be changed to get Apache running. After a normal installation of Suse Linux I had to only change a few
lines in the config. file (http.conf), server name, email address,... & the server was sending my web site
all over the place, to my great surprise :o).
I have to admit that I have only begun to scratch the surface of the possibilities that Apache gives you,
but at the beginning I was just happy that it worked at all :o) Now as I slowly add things like Virtual Hosts,
& cgi support I have to learn bit by bit how it works & how I get it to work. There are huge amounts
of documentation on the internet about apache, including Apache’s web site itself, where you will find most of
the answers you have. The Apache web site has complete documentation & a definitive list of all the directives that control apache.
Apache can be stopped, started, or restarted, simply by typing
/sbin/init.d/apache start|stop|restart & Apache will listen by default on port 80. You can check to see if it’s running
by starting netstat –an & you can see the connections to port 80 & also that there is a line 0.0.0.0:80 ,
which shows it’s waiting for any new incoming requests. Using netstat is a good way to check all the running daemons & open ports.
Another point that you have to remember is that every time your IP changes you should restart apache. This is a must if you have set
up apache to run virtual hosts, apache has to "see" it’s updated IP to the serve the virtual hosts properly.
In it’s default mode apache runs in stand alone mode, from which apache serves the one web site that is entered under the "document
root" in the config. file. This is the standard way that almost all web servers were run until the last few years. This meant that
only one web server could be run on one IP address & therefore could only one web site be served. Later versions of apache are equipped
with a feature known as Virtual Hosting, this enabled an almost unlimited number of "virtual hosts" to be served, i.e. multiple web
sites, from the one IP address. More to this later in the detailed web server section.
Here are segments of the http.conf file that were changed from the default settings. The changes in the logging were added
to improve the statistics that can be generated from the log files that apache maintains. The document root directive is where your
web site is saved on the server.
#
# ServerAdmin: Your address, where problems with the server should be
# e-mailed. This address appears on some server-generated pages, such
# as error documents.
#
ServerAdmin webmaster@highasakite.net
.................
# ServerName allows you to set a host name which is sent back to clients for
# your server if it's different than the one the program would get (i.e., use
# "www" instead of the host's real name).
#
# Note: You cannot just invent host names and hope they work. The name you
# define here must be a valid DNS name for your host. If you don't understand
# this, ask your network administrator.
# If your host doesn't have a registered DNS name, enter its IP address here.
# You will have to access it by its address (e.g., http://123.45.67.89/)
# anyway, and this will make redirections work in a sensible way.
#
ServerName highasakite.net
....................
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/usr/local/httpd/htdocs"
..................
#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/usr/local/httpd/htdocs">
..........................
#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
#
LogFormat "%v %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
#
# The location and format of the access logfile (Common Logfile Format).
# If you do not define any access logfiles within a <VirtualHost>
# container, they will be logged here. Contrariwise, if you *do*
# define per-<VirtualHost> access logfiles, transactions will be
# logged therein and *not* in this file.
#
#CustomLog /var/log/httpd/access_log common
#
# If you would like to have agent and referer logfiles, uncomment the
# following directives.
#
#CustomLog /var/log/httpd/referer_log referer
#CustomLog /var/log/httpd/agent_log agent
#
# If you prefer a single logfile with access, agent, and referer information
# (Combined Logfile Format) you can use the following directive.
#
CustomLog /var/log/httpd/access_log combined
Not a lot of changes really, considering the http.conf is over 1500 lines long. If apache on the other hand
should not work then the fault codes that the server daemon will display to your browser may give you a clue as to why. One very
important factor to remember is that if all the files on your web site are NOT world readable, i.e. readable to the others category,
then apache will display an "access denied" message. The same applies for directories that are not world readable & executable.