What are the features of Apache?
Functional features of Apache
1. Highly modular (Recommended learning: Getting Started with Apache )
Apache supports more functions in the form of modularization. The addition and deletion of different functions can be completed by loading and unloading modules. Similar to the modularization of the Linux kernel, the kernel driver can be loaded and unloaded. module. Constitutes the core modules model;
2. Supports dynamic loading and unloading of modules
is a function similar to hot-swapping, which can realize the service without restarting Situation loads and unloads modules and makes them available.
3. Support multi-channel processing module MPM
Apache can have three (processing) working modes, which are:
prefork- --Multi-process I/O model, one process handles one request, is the default working mode of Apache
In this working mode, there is a main process and multiple sub-processes, and those sub-processes are generated and recycled by the main process. The main process is responsible for generating sockets and managing sub-processes, but is not responsible for processing requests. The main process is executed as root;
The sub-process is the real role responsible for processing requests. There will be multiple idle sub-processes at the beginning. A process waits to handle a request, and a child process handles a request. The child process is executed by the apache user.
worker----Reuse multi-process I/O model
In this working mode, there is a main process, and the main process is also responsible for managing sub-processes Process does not process requests. The main process generates multiple sub-processes, and each sub-process generates multiple threads. One thread handles one request. In this way, assuming that the number of sub-processes is M and the number of threads of each sub-process is N, this working mode M*N requests can be processed concurrently. This mode takes up less memory and is mostly used for large websites.
event-----Event-driven model
event works similarly to worker, both handle M*N requests concurrently. But the improvement made by event is that the threads in each sub-process are divided in more detail, including management threads and service threads. Why is it designed like this?
We know that the HTTP1.1 version defaults to persistent connection keepalive. If a connection is established but no request is sent, the bandwidth of this connection will be occupied until the specified time and will not be released. Therefore, a management process has been added to specifically monitor the keepalive. Type of service thread, when a real request occurs, the management thread transfers the request to the service thread for processing. After the processing is completed, the management thread will release the resources of the service thread. Increased bandwidth utilization.
4. Virtual host
The number of visits to some websites is pitifully low. If a dedicated server is used to build such a low number of visits, it is really not worth it. Therefore, I came up with the idea of building multiple websites on one server. Multiple websites share one server to reduce resource consumption. This function is called the virtual host function.
A server builds multiple websites, each website corresponds to a different domain name. When an external client wants to access, DNS will resolve the domain names of these different websites to the same server, and the server will resolve the domain names of these different websites to the same server according to the header of the HTTP request. The domain name information in the row will forward the request to the corresponding directory resource.
Tips: The difference between a virtual host and a virtual machine->A virtual host is a function of deploying multiple websites on one host. The hosts that support so many websites run the same operating system; A virtual machine is a system that virtualizes multiple hosts through VMware, LVM and other technologies. These virtual hosts can run different operating systems.
5.CGI universal gateway interface
supports dynamic web pages. It will be very obscure to say this. Let’s first talk about what a gateway is. A gateway is the interface through which hosts in two network segments communicate. Hosts in the same network segment do not need to go through the gateway when communicating. However, once hosts in different network segments communicate, To communicate, the data needs to be handed over to the gateway first, and then the gateway can transfer it to another network segment.
Similarly, looking at CGI, the web server can only send static pages. When the server receives a file request such as index.php, the server cannot send index.php.
Because this is a dynamic file, CGI will process index.php into a prescribed data format at this time, and then hand it over to the PHP interpreter for execution, and then the executed data will be processed by CGI, and finally The results are sent from the server to the client. The CGI here serves as the conversion interface between static requests and dynamic requests.
6. Support reverse proxy
7. Can achieve load balancing
8. Support path aliases
In order to prevent users from knowing the real directory of server resources, you can make an alias for the directory. Users only need to know the alias, and the alias will automatically jump to the real directory.
9. Security authentication mechanism can be implemented
The above is the detailed content of What are the features of Apache?. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











To set up a CGI directory in Apache, you need to perform the following steps: Create a CGI directory such as "cgi-bin", and grant Apache write permissions. Add the "ScriptAlias" directive block in the Apache configuration file to map the CGI directory to the "/cgi-bin" URL. Restart Apache.

Apache connects to a database requires the following steps: Install the database driver. Configure the web.xml file to create a connection pool. Create a JDBC data source and specify the connection settings. Use the JDBC API to access the database from Java code, including getting connections, creating statements, binding parameters, executing queries or updates, and processing results.

There are 3 ways to view the version on the Apache server: via the command line (apachectl -v or apache2ctl -v), check the server status page (http://<server IP or domain name>/server-status), or view the Apache configuration file (ServerVersion: Apache/<version number>).

When the Apache 80 port is occupied, the solution is as follows: find out the process that occupies the port and close it. Check the firewall settings to make sure Apache is not blocked. If the above method does not work, please reconfigure Apache to use a different port. Restart the Apache service.

How to view the Apache version? Start the Apache server: Use sudo service apache2 start to start the server. View version number: Use one of the following methods to view version: Command line: Run the apache2 -v command. Server Status Page: Access the default port of the Apache server (usually 80) in a web browser, and the version information is displayed at the bottom of the page.

How to configure Zend in Apache? The steps to configure Zend Framework in an Apache Web Server are as follows: Install Zend Framework and extract it into the Web Server directory. Create a .htaccess file. Create the Zend application directory and add the index.php file. Configure the Zend application (application.ini). Restart the Apache Web server.

Apache cannot start because the following reasons may be: Configuration file syntax error. Conflict with other application ports. Permissions issue. Out of memory. Process deadlock. Daemon failure. SELinux permissions issues. Firewall problem. Software conflict.

To delete an extra ServerName directive from Apache, you can take the following steps: Identify and delete the extra ServerName directive. Restart Apache to make the changes take effect. Check the configuration file to verify changes. Test the server to make sure the problem is resolved.
