Posts

Showing posts with the label Apache

Web Site Authentication vs. Authorization

Many people confuse authentication and authorization, and some even think they are the same thing, which they aren’t. To understand the differences consider the following example. When you want to visit a foreign country what do you need? A passport and a visa. The passport is a document that authenticates you to the foreign country. It tells them that you are really who you claim to be. So, when you present your passport, you are authenticating yourself to the foreign officials. Next, you must show proof that you are allowed (that is, authorized) to enter the foreign country. This is the visa document. Now, in computer terms, the authentication typically involves submitting a username and password. A successful submission and acceptance of a username and password states that you are who you claim to be. In other words, you have authenticated yourself. A given resource that you are trying to access may require authorization in addition to authentication. For example, if y...

Apache’s Virtual Hosting Capabilities

When you set up Apache on an Internet host it can respond to an HTTP request for that host. For example, if you set up Apache on a host called server1.doman.com, Apache will serve HTTP requests for this host. However, if you set up your DNS records such that two other hostnames (say www. mycompany-domain.com and www.friendscompanydomain. com) point to the same machine, you can have Apache serve these two domains as virtual Web sites. In such a case www.mycompany-domain.com is considered the primary Web hostname (main server) and the rest of them will be considered as virtual Web site or virtual hosts. Apache allows virtual hosts to inherit configuration from the main server, which makes the virtual host configuration quite manageable in large installations where some contents can be shared. For example, if you decided only to have a central CGI repository and to allow virtual hosts to use the scripts stored there, you do not need to create a ScriptAlias directive in each v...

Configuring Apache Main Server

The main server configuration applies to the default Web site Apache serves. This is the site that will come up when you run Apache and use the server’s IP address or host name on a Web browser. Port The very first directive in this section is the Port directive, which sets the TCP port that Apache listens to for connections. The default value of 80 is the standard HTTP port. If you change this to another number, such as 8080, you can only access the server using a URL such as http://hostname:8080/. You must specify the port number in the URL if the server runs on a nonstandard port. There are many reasons for running Apache on nonstandard ports, but the only good one I can think of is that you do not have permission to run Apache on the standard HTTP port. As a nonroot user you can only run Apache on ports higher than 1024. After you have decided to run Apache by using a port, you need to tell Apache what its user and group names are. User and Group directives The User ...

Configuring Apache

By default, Apache reads a single configuration file called httpd.conf. Every Apache source distribution comes with a set of sample configuration files. In the standard Apache source distribution, you will find a directory called conf, which contains sample configuration files with the -dist extension. The very first step you need to take before you modify this file is to create a backup copy of the original. The httpd.conf file has two types of information: comments and server directives. Lines starting with a leading # character are treated as a comment line; these comments have no purpose for the server software, but they serve as a form of documentation for the server administrator. You can add as many comments as you want; the server simply ignores all comments when it parses the file. Except for the comments and blank lines, the server treats all other lines as either complete or partial directives. A directive is like a command for the server. It tells the server t...

Installing Apache from Source Code

Installing Apache by compiling the code from the source distribution is the preferred installation method because it allows you to configure the server to fit your needs. Any binary installation that you download will have someone else’s configuration, which you may not be able to alter to suit your needs. For example, if you download and install a binary that has CGI support, you may have to live with the CGI support even if you never run CGI programs. If the CGI module is configured as a dynamically shared module, then you can disable it very easily; however, if the support is statically built into a binary, then you’ll just have to live with CGI. If you compile a lean and mean Apache server from the source distribution, however, you get the components that you need with no wasted processes or disk space. The Apache source distribution comes with a script called configure that allows you to configure the source tree before you compile and install the binaries. From the ...

Installing Apache

Although compiling your own Apache binaries may seem like a bit of work, it’s worth the effort. As you become more familiar with Apache, you will learn that it is the only Web server that provides virtually all (if not more) of the functionalities of a full-blown commercial server, while letting you look at how these functionalities are implemented in the source. I find this aspect of Apache fascinating. For people who are not C programmers but who still need a powerful, free, Web server, however, playing around with a lot of ANSI C code may not exactly be a favorite pastime. Fortunately, there’s nothing to worry about—Apache comes in both source code and in prebuilt binary packages. Whenever you obtain free software (source code or binary files) from the Internet, make sure you’re not getting it from an unknown Web or FTP site. What I mean by an unknown can be better understood by use of an example. Say you want to obtain free Java-based Web browser software developed by ...

Apache 2.0 Architecture

Apache Server 2.0 makes Apache a more flexible, more portable, and more scalable Web solution than ever before. The new 2.0 releases offer many improvements. The first major change in Apache 2.0 is the introduction of multiprocessing modules (MPMs). To understand why MPMs are created, you need to understand how Apache worked before. Apache Version 1.3 or earlier used a preforking architecture. In this architecture, an Apache parent process forked a set of child processes, which serviced the actual requests. The parent process simply monitored the children and spawned or killed child processes based on the amount of requests received. Unfortunately, this model didn’t work well under platforms that are not process-centric such as Windows. So, the Apache Group came up with the MPMbased solution. Each MPM is responsible for starting the server processes and for servicing requests via child processes or threads depending on the MPM implementation. Several MPMs are available. ...

Apache Feature List

One of the greatest features that Apache offers is that it runs on virtually all widely used computer platforms. At the beginning, Apache used to be primarily a Unixbased Web server, but that is no longer true. Apache not only runs on most (if not all) flavors of Unix, but it also runs on Windows 2000/NT/9x and many other desktop and server-class operating systems such as Amiga OS 3.x and OS/2. Apache offers many other features including fancy directory indexing; directory aliasing; content negotiations; configurable HTTP error reporting; SetUID execution of CGI Programs; resource management for child processes; server-side image maps; URL rewriting; URL spell checking; and online manuals. The other major features of Apache are: Support for the latest HTTP 1.1 protocol: Apache is one of the first Web servers to integrate the HTTP 1.1 protocol. It is fully compliant with the new HTTP 1.1 standard and at the same time it is backward compatible with HTTP 1.0. Apache is re...

The Number One Web Server

More than 60 percent of the Web servers in the world use Apache, according to a prominent Web server survey company called Netcraft . Netcraft publishes the Top Server statistics periodically. If you want to put faces to the numbers, you can visit www.apache.org . What Apache has accomplished is simply amazing! Who knew that an open source Web server could consistently beat two major commercial competitors, Microsoft and Netscape as a Web server platform! Everyone has his or her own reason for why Apache is so popular. Here are mine: Apache is a highly configurable Web Server with a modular design. It is very easy to extend the capabilities of Apache Web server. Anyone with decent C or Perl programming expertise can write a module to perform a special function. This means that there are tons of Apache modules available for use. Apache is a free, open source technology. Being free is important but not as important as being open source. Apache works great with Perl, ...