About Apache and Basic Configuration

xiaoxiao2021-03-06  104

Apache Introduction and Basic Configuration I. Apache Introduction: Apache is the world's ranking web server, according to Netcraft (www.netsraft.co.uk) survey, 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 strong based on File configuration (httpd.conf). 4) Support Universal Gateway Interface (CGI) 5) Support Virtual Host. 6) Support HTTP Authentication. 7) Integrated Perl. 8) Integrated Proxy Server 9) You can monitor servers through a web browser State, you can customize logs. 10) Support 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 GUI support.

The following is the license of Apache / * ========================================== ========================================================== . * * Redistribution and use in source and binary forms, with or without * 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 following 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 materials provided with the * distribution. * * 3. The end- user documentation included with the redistribution, * if any, must include the following acknowledgment: * ". This product includes software developed by the * Apache Software (http://www.apache.org/) Foundation" * Alternately, this acknowledgment may Appear in the software it self, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Apache" and "Apache Software Foundation" 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 Foundation. * * THIS SOFTWARE IS PROVIDED `` AS IS '' AND ANY EXPRESSED OR IMPLIED * 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 OR 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 * Individual s 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 XVF Apache_x.x.xx.tar.gz2. Compile Apache in the src directory ./configure available ./configure-help|less get help, make, make install, install

3. Apache Starts and close Sbin / Apachectl Start Sbin / Apachectl Stop Sbin / Apachectl Restart

4. Some modules introduction: The following group modules Control enter and verify the basic authentication of the Unix-Style password 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. Apache1.3 The default directory layout is: ./bin server binary, apachectl original ./conf apache configuration file ./include/apache apache title file ./libexec shared object file ./man man page ./sbin server Binary, apachectl, log rotator ./cgi-bin default CGI original / binary directory ./share/htdocs default file root ./htdocs/manual apache manual ./share/icon contains a directory of various icon gifs. Directory of the VAR / Apache / Log log file ./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, Apachectl under / usr / local / apache / confs or / etc / httpd / confation, access_log, record users under / usr / local / apache / bin or / etc / httpd / bin Access information, in ../logs ERROR_LOG, record users access error message, also in ../logs

7. httpd.conf Basic Setting Port, Apache Which TCP port is listened, 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,

Is a container command. The end of the format.

And related and instructions, to let you control the way Apache behavior on each directory or each file. The instruction is placed, and the subdirector is applied.

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 on the 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,

ALOWOVERRIDE controls which instruction will be used. If AllowOverride is set to None. Apache does not even check the access file.

Allowoverride Parameters: 1) Authconfig, the authorization instructions which allows usage; 2) FileInfo, command to control document type and processing method; 3) Indexes, use one of them to control the display list, icon, etc. display; 4) LIMIT, allows instructions to control host access; 5) Options, use 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 instruction, more typical configurations may be: Order allow, deny allow from all deny aaa.com All hosts are allowed, except for hosts from the AAA.com domain.

If the ORDER DENY, Allow Deny from all allow from 11.23.44 deny is 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.

III. Special configuration: 1. Support User Personal Home: Add UserDir / Home / * / Public_html Setting User You can use CGI, etc. in ../conf/httpd.conf. CGI-bin .cgi ..., # there is no need to set up 2. Virtual host settings:

1) If 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, the multiple IP addresses are bound to multiple virtual hosts on a machine's network card. # / 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: What is DocumentRoot? If / home / httpd / aaa

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

There must be NameVirtualHost in the forefront, below is the virtual host, but also point to the DNS of AAA.YOOOOOMAIN.com 192.168.0.2

3. Apache user authentication basic Apache user authentication assumption / aaa off file. Htaccess, the content is as follows: Authname "please give me your id number and password" Authty Basic AuthiSerfile /etc/.Passwd Require Valid-User

Generate files /etc/.passwd, htpasswd -c /etc/.passwd username with htpasswd

/// end ///

转载请注明原文地址:https://www.9cbs.com/read-123985.html

New Post(0)