history
Apache was originally developed by the National Center for Advanced Computing at the University of Illinois at Urbana-Champaign. Since then, Apache has been continuously developed and strengthened by members of the open source community. Apache server has a reputation of reliability and credibility, and has been used on more than half of Internet websites-especially almost all the hottest and most visited websites.
At first, Apache was just an open source alternative to Netscape Web server (now Sun ONE). Gradually, it began to function and speed. Beyond other Unix-based HTTP servers. Apache has been the most popular HTTP server on the Internet since1April 1996:1May 1999, which runs on 57% of the web servers; By July 2005, this proportion had risen to 69%.
The author claims that this name was originally chosen because it is easy to remember, but the most popular explanation is that this name comes from 1995. When developing Apache, the code of NCSA HTTPd 1.3, the most popular HTTP server at that time, was modified, so it was "a patchwork" server. But it is explained in the FAQ of the server official website: "The name' Apache' commemorates a branch of American Indians called Apache (Hindi), and it is well known that they have superb fighting strategies and endless patience." In any case, the Apache 2.x branch does not contain any NCSA code.
characteristic
Apache supports many features, most of which are realized by compiled modules. These features range from server-side programming language support to authentication schemes. Some common language interfaces support Perl, Python, Tcl and PHP. Common authentication modules include mod_access, mod_auth and mod_digest. Other examples are SSL and TLS support (mod_ssl), proxy module, useful URL rewriting (implemented by mod_rewrite), customized log file (mod_log_config) and filtering support (mod_include and mod_ext_filter). Apache logs can be analyzed through a web browser using free scripts AWStats or Visitors.
2.x version
The 2.x version of Apache has made important enhancements to the Apache 1.x version. This includes: threading, better support for non-UNIX platforms (such as Windows), new Apache API and IPv6 support.
evaluate
In August 2004, PC Magazine》2004 selected 10 as the best software product in the past 30 years. Some of them either have the most glorious history or are the most creative. Its evaluation of apache is: third place: Apache (Apache, 1995 introduction) Apache has now evolved into a "lamp", that is, a combination of Linux, Apache, MySQL and PHP. This is an open source software project, which has posed a serious threat to Microsoft. " NET "strategy. Especially Apache web server, let users fully experience the stability, reliability and customization of developing source software.
When Apple.com commented on apache, he said: Apache is an important part of the constantly developing server software. It is free, but it is priceless. Apache is an absolute treasure in the resource opening movement, because it is not a personal patent but free to the public. Once you have these source codes, programmers are free to do what they want-when other programmers take over their work, they can be given the same rights to change and modify their own source codes.
To annotate ...
Although new vulnerabilities are constantly being discovered, they can always be fixed quickly because of their open source characteristics. So overall, its security is still quite high.
()[# page _ #][# page _ #]AddHandler CGI-script。 Computer generated image
AddHandler server resolved. shtml
Sethandler cgi script
AddHandler defines which extension is described by which string.
SetHandler specifies that all files in the directory are described by this string.
The commands I mentioned here are closely related to their structure. The relationship between handlers and types will be described below. Many things can't be seen clearly from the outside. Next, let's look at it from the inside.
Basic structure of program
-
Apache is very cross-platform. In order to achieve this goal and simplify the burden of module writers, Apache has completed many basic functions, such as IO and memory allocation, which are independent of specific platforms. There are also some useful routines, such as Hashtable and Array. In the whole system, Apache has a basic point. Using simple structure and algorithm as much as possible is not only easy to understand and maintain, but also improves its stability.
On UNIX system, Apache adopts multi-process model and multi-thread model on the window. In the multi-process model, the sub-process handles the customer request and the parent process manages the sub-process. When the system is overloaded, the parent process will start multiple child processes. When the system is idle, the parent process will kill several child processes. The number of subprocesses is between "MinSpareServers" and "MaxSpareServers". Moreover, the number of requests handled by each subprocess is limited, which can solve the problems of memory leakage. All process states are recorded in shared memory. Because the state of each process is recorded in a small piece of memory, usually only this piece of memory is read and written, Apache does not use any synchronization mechanism.
Apache uses several multi-process server models mentioned in Richard Steve's book, and chooses to use different methods on different systems according to their characteristics:
1. Accepted:
Only when accept is implemented at the kernel level, it is possible to block when accept.
2. Choose:
Block when selecting.
3. Mutually exclusive/locked files:
Use mutex or lock_file to mutually exclude accpet.
All three methods need shielding, but the difference is that shielding is different. The first two methods will cause the so-called giant group problem: multiple processes blocked on the same resource will be awakened at the same time, which will lead to re-competition. But according to Richard Steve, the first method is the fastest, the second is the second, and the third is the slowest. In fact, the third method will also have the problem of giant group on linux.
Although Apache does not emphasize performance, it does not mean that they do not attach importance to performance. On the contrary, Apache thinks realiable is the first server, but Apache's performance is still good.