The Apache Web Server
The Apache Web server is a highly specialized software application used to serve billions of Web pages daily. The Apache Web server is the single most used Web server on the Internet today.
Apache's most basic function is to serve static, unchanging HTML documents. This has the benefit of being the easiest method to implement Â HTML is a simple language. If your site as you envision it is a simple affair, then by all means explore that. If you want dynamically created Web pages driven by a powerful database, then read on. Apache can be used with Perl or PHP to generate Web pages according to the rules given in a Perl or PHP script. This is more complicated than the static HTML method, but the extra thought, planning and time is well worth the effort.
Apache may work with several programming languages, be they scripted or compiled languages. Apache provides for a wide range of data crunching abilities through the use of these various languages.
Start the Apache Server
httpddoes when invoked is to locate and read the configuration file,
httpd.conf. Within this file are the locations and settings for the Apache server's startup. You would specify what your root web location is, as well as dozens of other configuration directives.
During startup, the Apache server parses the
httpd.conf file and applies the settings and directives you have within this file to that instance of the Apache server. The locations for your files can be anywhere on the current machine, either on a Linux operating system or a Windows operating system. It is understood that the user is adept on either or both of these operating systems before the installation of Apache.
When installing on a Windows operating system, you have the option of compiling the server's files from the source code, or using a pre-compiled binary file. If you have a Windows version higher than Windows 98 and have the MSI installer up to date, you can download the .msi package to install Apache on your Windows machine. This is recommended, as it greatly simplifies the installation and ensures that any errors that may happen are handled and repaired by the installation program. The MSI Installer is a program that has within it the rules for installing almost any program on the Windows operating system.
Startup On A Windows Operating System
Start up on a Windows operating system is a straightforward affair. You simply state the path to the
Apache.exe file along with a switch or two. You then give the location of the
http.conf file and the root of the Apache source files directory.
First we declared the path to the
Apache.exe executable. We then included startup switches. Next we included the path to the httpd.conf file for startup options. Finally, we gave the location of the root for the Apache installation.
Startup On A Linux Operating System
Startup on a Linux system is as easy as on a Windows system. You first give the location to the
apachectl executable and give it a switch. You then give the location of the
httpd.conf file for start up options and directives.
/usr/local/apache2/bin/apachectl -f /usr/local/apache2/conf/httpd.conf
We first declared the path to the apachectl executable. We then included start up switches. Next we included the path to the
httpd.conf file for startup options.
Stop or Restart the Server
In order to stop or restart Apache, you must send a signal to the running httpd processes. We'll examine stopping the server on a Windows machine first. This is as easy as pressing
ctrl + c in most cases, so we won't delve deeply into stopping the Apache server on a Windows machine. Instead, we'll concentrate on the command line switches that, save for the path to the executable, will be the same on a Linux as well as Windows operating system.
On Linux, it is possible to use the Unix inspired kill directive, as follows:
This command "kills" the process that runs Apache, resulting in an immediate shutdown. This command isn't recommended, since waiting calls to the Apache server will be abandoned, possibly resulting in failed server calls in the future. That is, any page or CGI or related database calls will immediately be abandoned, resulting in errors the next time you start Apache and the user tries to use the affected portion of your Web site.
There are a number of switches that can be used to start or stop or restart the server. A full listing of these switches is beyond the scope of this article, but the manual that comes with the Apache installation explains all of these switches and a great deal more Â it's advised that you read the manual before using any of the higher functions inherent to Apache.