web server -apache

HTML languages: HTML

Text using html language called hypertext, "hypertext" refers to the inside pages can contain images, links, and even music, programs and other non-text elements.

HTTP protocol: Hypertext Transfer Protocol

 

HTTP using a Uniform Resource Identifier (URL) to establish a connection and transfer data. It is one of the data transfer protocol based on TCP / IP communication protocol, an application layer protocol.

 

URL: Uniform Resource Identifier

 

Uniform Resource Identifier is a kind of resources on the Internet location and access methods of simple representation, is the address that identifies the resource on the Internet.

Format: http://www.learn.com:80/images/1.jpg

 

URI: Uniform Resource Identifier, URI and URL are positioning resources position is the position information indicating the resource, like latitude and longitude. URI is a broad meaning broader definition, and URL is a subset of URI.

A, apache Detailed

1 Overview

  apache is ranked first in the world using a web server software. It can run on almost any computer platform widely used because of its cross-platform security and is widely used, it is one of the most popular web server software. It is fast, reliable, and can be expanded through a simple API, the Perl / Python / php etc. interpreter built into the server.

  apache can support ssl technology to support multiple virtual hosts. apache process is the basis for the structure, the process consumes more system than the thread spending less suitable for multi-processor environment, so in a apache web site expansion, usually increase the server or expansion of the cluster nodes instead of increasing treatment device. Apache is still by far the most used Web server in the world.

2. Operating mode

  There are three stable apache MPM mode (MPM: multiprocessing module), they are prefork, worker, event.

prefork mode of operation

  apache start at the beginning, on a number of pre-fork a child process, then wait for requests to come in. The reason to do this is to reduce the frequency of process creation and destruction overhead. Each child process only one thread at a time, can only handle one request.

  Advantages: mature and stable, compatible with all old and new modules. At the same time, do not worry about thread safety issues.

  Cons: a process relatively more system resources, consume more memory. Moreover, it is not good at handling high concurrent requests.

worker operating mode

  The use of mixed-mode multi-process and multi-threaded. He also previously fork several child processes (smaller number), then each child process created some threads, including both a listening thread. Each request is over, it will be assigned to a thread to serve. Thread lighter than the process, because the thread is usually shared memory space of the parent process, therefore, memory usage will reduce the number. In high concurrency scenarios, because there are more than prefork available threads, performance is more superior.

  Advantages: takes up less memory, outstanding performance under high concurrency

  Cons: Must consider thread safety issues

event mode of operation

  And worker operating modes like, the biggest difference is that it solves the next keep-alive scenario, the waste of resources issues have long been occupied by the thread. event MPM, there will be a dedicated thread to manage the keep-alive type of thread, when there is a real request over the request to the server thread, after the implementation, but also allow it to be released. This enhances the request processing capability at high concurrency scenarios.

  HTTP using tcp keepalive way to reduce the number of connections, but due to the need to bind with the server thread or process, resulting in a busy server consumed all the threads. event MPM is a new model to solve this problem, it is the process of separating from the service connection. In the server process is very fast, but also has a very high click-through rate, the number of threads available is a critical resource constraints, this time event MPM is the most effective way, but can not access work under HTTPS.

View:

httpd -V |grep -i "server mpm"

Targeting:

, Specify the options at compile time, - with-mpm = xxx.

3. The relevant file save location

Profile Location:

  Source Package Installation: PREFIX / etc / httpd.conf (main profile)

          PREFIX / etc / extra / *. Conf (sub profiles)

  rpm package: /etc/httpd/httpd.conf

Web page file location:

  Source Package Installation: PREFIX / htdocs /

  rpm package: / var / www / html /

Log file location:

  Source Package Installation: PREFIX / logs /

  rpm package: / var / log / httpd /

4. Detailed profiles

Note: apache configuration file rigorous case-sensitive

The basic configuration parameters for the host environment

ServerRoot / usr / local / apache2 #apache home directory 
the Listen: 80              # listening port 
LoadModule php7 # load modules related to 
the User 
Group # users and groups 
ServerAdmin # administrator mailbox 
when ServerName # name server (DNS does not use a temporary resolve the default. do not open) 
ErrorLog " logs / error_log "               # server error log 
CustomLog " logs / access_log " the Common access log # 
DirectoryIndex index.html index.php # default page file name, the priority order of 
the Include etc /extra/httpd-vhost.conf # load the contents of sub-profile

Home directory and rights

DocumentRoot "/ usr / local / apache2 / htdocs" 
# page file storage directory (default)
 <Directory "/ usr / local / apache2 / htdocs"> 
# define specified directory permissions 
Options the Indexes FollowSymLinks 
None # without any additional permission 
All # All permission (except MultiViews remove) 
the Indexes # visibility (when there is no default page file in this directory, display directory contents) 

FollowSymLinks # permit soft link to another directory 
MultiViews # permit file name Pan match (need to manually open the module to be effective negotiation) 
AllowOverride none 
# define whether to allow .htaccess file in the directory permissions to take effect 
none # .htaccess permissions does not take effect 
All # all file permissions take effect 
AuthConfig # file, only the certification authority web pages take effect 
control Require all granted (denied) # access list
 </ Directory> 

<IfModule dir_module>              # This tab is used to specify which page to automatically load the file when you access to the specified directory 
DirectoryIndex index.php index.html # write more, but there is a priority of the points
 </ IfModule>

Guess you like

Origin www.cnblogs.com/sswind/p/12033435.html