I. Introduction to Apache:
Apache is the world's ranking web server, according to the survey conducted by Netcraft (www.netsraft.co.uk), more than 50% of the world in the world uses apache.
In April 1995, the earliest Apache (version 0.6.2) was released by Apache Group. Apache Group is a non-profit organization that operates through the Internet, which is made to determine which content should be included in the standard release of the Apache Web server. Permit anyone to modify the hossip, provide new features and port it to the new platform, and other work. When the new code is submitted to the Apache Group, the group reviews its specific content, test, if It is considered satisfactory, which is integrated into the main release of Apache.
Apache features:
1) Almost on all computer platforms.
2) Support the latest HTTP / 1.1 protocol
3) Simple and powerful file-based configuration (httpd.conf).
4) Support Universal Gateway Interface (CGI)
5) Support the virtual host.
6) Support HTTP certification.
7) Integrate Perl.
8) Integrated proxy server
9) You can customize the log through the status of the server through the web browser.
10) Support the server side contains commands (SSI).
11) Support Secure Socket Layer (SSL).
12) Tracker with the user session process.
13) Support Fastcgi
14) Support Java servlets.
...
"Maybe IT IS, Maybe Not):
Apache does not provide the graphical user interface (GUI), but the recent Apache version already has a support of GUI.
The following is a license for Apache
/ * ================================================================================================================================================================ ====================
* The Apache Software License, Version 1.1
*
* CopyRight (c) 2000 The Apache Software Foundation. All Rights
* Reserved.
*
* Redistribution and use in Source and Binary Forms, with or wel
* Modification, Are Permitted Provided That The Following Conditions
* Are Met:
*
* 1. Redistributions of Source Code Must Retain The Above Copyright
* NOTICE, this List of conditions and the folload disclaimer.
*
* 2. Redistributions in Binary Form Must Reproduce The Above Copyright
* Notice, this List of conditions and the following disclaimer in
* The documentation and / or other matials provided with the
* Distribution.
*
* 3. The end-user documentation, * if any, munt incrude the folload acknowledgment:
* "This product incrudes Software Developped by the
* Apache Software Foundation (http://www.apache.org/). "
* Alternately, this Acknowledgment May Appear in The Software Itself,
* If and wherever such third-part allownowledgments Normal Appear.
*
* 4. The name "apache" and "apache software found" MUST
* NOT BE Used to endorse or promote products derived from this
* Software without prior written permission. For Written
* Permission, please contact apache@apache.org.
*
* 5. Products Derived from this Software May Not Be Called "Apache",
* Nor May "Apache" APPEAR in their name, without prior written
* Permission of the apache software firmation.
*
* This Software Is Provided `` as '' and any expressed or ketlied
* Warranties, Including, But Not Limited to, The Implied Warranties
* Of Merchantability and Fitness for a Particular Purpose Are
* Disclaimed. In no Event shall the apache software foundation or
* ITS Contributors Be Liable for Any Direct, Indirect, Incidental,
* Special, Exemplary, OR Consequential Damages (Including, But Not
* Limited to, Procurement of Substitute Goods Or Services; LOSS OF
* Use, data, or profits; or business interruption) However Caused and
* ON ANY THEORY OF LIABILITY, WHETHER in Contract, Strict Liability,
* OR TORT (Including NEGLIGENCE OtherWise) arising in any way out
* Of the use of this software, Even if advised of the Possibility of
* Such Damage.
* =========================================================================================================================================================================================== =================== *
* This Software Consists of Voluntary Contributions Made by Many
* Individuals on Behalf of the Apache Software Foundation. For more
* Information on The Apache Software Foundation, please See
*
*
* Portions of this Software Are Based Upon Public Domain Software
* Originally Written At the National Center for Supercomputing Applications,
* University of Illinois, Urbana-Champaign.
* /
It can be seen that Apache does not require anyone to open a modification of Apache (not constrained by the GPL terms).
II. Basic configuration and instructions of Apache:
1. Get Apache:
The most convenient way to get Apache source is to http://www.apache.org, select the latest version. then,
TAR XVZF APACHE_X.X.XX.TAR.GZ
2. Compile Apache
In the SRC directory
./configure can be used ./configure-help|less gets help,
Make, Make Install, Install
3. Apache startup and close
Sbin / apachectl start
SBIN / APACHECTL STOP
SBIN / APACHECTL Restart
4. Some modules introduction:
The following group modules control into and verify
Acess enters control
Auth checks the basic authentication of UNIX-Style passwords and group files.
Auth-anon uses anonymous FTP-Style UserNames and passwords.
Auth-dbm uses Berkeley DB files to store usernames, passwords, and group information. If you have a lot of usernames and care about performance, this is useful.
Digest uses HTTP Digest Certification, which is more secure than basic authentication.
Expire module lets you customize Expire expired time
5. The default directory layout of Apache1.3 is:
./bin
Server binary, ApachectL original
./conf
Apache configuration file
./include/apache
Apache title file
./libexec
Shared object file
.
MAN page
./sbin
Server binary, apachectl, log rotator
./cgi-bin
Default CGI original / binary directory
./share/htdocs
Default file root
./tdocs/manual
Apache Manual
./share/icon
Contains a directory of various icons GIFS
./var/apache/log
Log file directory
./var/apache/proxy
Proxy cache directory ./var/apache/run
HTTPD.PID (file containing the main HTTPD process identifier) in this directory
6. The main documents are as follows:
HTTPD.CONF, under / usr / local / apache / conf or / etc / httpd / confes
Apachectl, under / usr / local / apache / bin or / etc / httpd / bin
Access_log, record user access information, in ../logs
Error_log, record user access error message, also in ../logs
7. HTTPD.CONF basic settings
Which TCP port is listening, and the Apache is listening, and the default port of HTTP is 80. If you use other ports, you have to specify port in URLs to connect your server,
User, group due to security, on Linux, you can set User and Group to Nobody
The ServerRoot parameter should be the basis for the Apache installation. Unless you move the surrounding information, its value is the same as the value you give.
ServerName, if your machine has multiple names or IP addresses, set the name of the Apache tablet server.
DocumentRoot is the root directory of the web tree,
Userdir When you enable ~ UserName Processing Request, this instruction tells Apache which directory is appended to the user's home directory (Home). Userdir is set to public_html. Users will only have basic web service functions,
The FOLLOWSYMLINKS option tells Apache that it can link from the document root directory external tracking symbolic link. Inside the document root directory, FollowSymlinks and Indexes are in turn on (ON). If the default index file (usually index.html) does not exist, the directory list is allowed to display.
In Directory, use Options instructions You can control what options are allowed.
Options directive:
1) The Execcgi CGI script can run in this directory tree.
2) FOLLOWSYMLINKS In this directory, the server will track the symbolic link. Note: Even if the server tracks the symbolic link, it does not change the path name used to match different regions. Note: If set in the area, this option will be ignored.
3) The inclines server-side inclusion is allowed.
4) The includeSnoExec server side reference is allowed, but #Exec command and the #include of the CGI scriptor are disabled.
5) Indexes If the URL that is required to map to the directory and there is no DirectoryIndex (for example, index.html) in this directory, the server will return a list of formatted directories.
6) MultiViews Handling Multiple Browsing Content is allowed.
7) SYMLINKSIFOWNERMATCH The server only tracks the symbolic links owned by the target file or the directory by linking the user ID.
8) All things outside MultiViews. If there is no Options directive, the default is ALL.
The AccessFileName command is set (the default setting is .htaccess). In any directory, the Apache configuration instruction can be placed in a file called .htaccess. The instructions can also be applied to subdirectory in the catalog. In the access file, Allowoverride controls which instruction will be used. If AllowOverride is set to None. Apache does not even check the access file.
ALOWOVERRIDE parameter:
1) AUTHCONFIG, which is allowed to use;
2) FileInfo, used to control the document type and instructions for processing methods;
3) Indexes, use one of the instructions to control the display of the directory list, icon, etc.
4) LIMIT, allowing instructions to control host access;
5) Options, using one of the Options instructions.
"Allow" and "DENY" instructions are used to control access. The third instruction "Order" controls the order of use of these instructions. If you set the order to allow, deny, without specifying which host is rejected, all hosts are assumed to be disabled. In this example, the Allow instruction is selected, and the DENY instruction is generally applied. In .htaccess file or
ORDER ALOW, DENY
ALLOW FROM ALL
Deny aaa.com
All hosts are allowed, except those hosts from the aaa.com domain.
If in contrast,
ORDER DENY, ALOW
Deny from all
ALLOW FROM 11.23.44
Deny was first checked. Only hosts from the 11.23.44 IP network are allowed to access. It may also specify a network mask, parameter 11.23.44.0/255.255.255.0 is equivalent to the above example.
Three. Special configuration:
1. Support User Personal Homepage:
Add to join in ../conf/httpd.conf
Userdir / home / * / public_html
Set up users can use CGI, etc .:
Options Execcgi
SetHandler CGI-bin # If addHandler cgi-bin .cgi is set globally ...,
# 这 这 这 设 设
Directory>
2. Virtual host settings:
1) IP-based virtual host
If the IP address of the machine is 192.168.0.2, the virtual IP is 192.168.0.3
First, bind multiple IP addresses to serve multiple virtual hosts on a network card of a machine.
# / sbin / ifconfig eth0: 0 192.168.0.2 Netmask 255.255.255.0 Broadcast 192.168.11.255 Up
# / sbin / route add -host 192.168.0.2 eth0: 0
Set ../conf/httpd.conf file:
See what documentroot is, if / home / httpd
Documentroot / Home / httpd / aaa
Virtualhost>
Create a directory
/ home / httpd / aaa,
2) Name-based virtual host:
Edit ../conf/httpd.conf
NamevirtualHost 192.168.0.2
Documentroot / Home / httpd / aaa
Servername aaa.yourdomain.com
Virtualhost> There is NameVirtualHost in the forefront, below is the virtual host,
You also need to point the DNS of Aaa.yourDomain.com to the IP address 192.168.0.2
3. Apache User Certification
Basic Apache User Certification
Assume that the files under the directory / home / aaa need to be user authentication, in httpd.conf
Add below
ALLOWOVERRIDE AUTHCONFIG
ORDER ALOW, DENY
ALLOW FROM ALL
Directory>
Used in the directory / home / aaa. Htaccess, the content is as follows:
Authname "please give me your id number and password"
Authtype Basic
Authiserfile /etc/.passwd
Require Valid-User
Generate file /etc/.passwd with htpasswd,
htpasswd -c /etc/.passwd username