Apahce configuration instructions can be divided into two blocks, core instructions and instructions provided by third parties. In apache, each instruction corresponds to a module, and among all modules, the most important ones are core_module, so_module, http_module, and mpm modules. Except for so_moudle, other modules cannot be turned off or disabled.
1: httpd.conf
(1) Main server part
1, ServerName: Define the apache default host name, you can Is the domain name or IP address
2, ServerRoot: used to define the directory where the server is located, this path is usually specified by --prefix during configuration
3, DocumentRoot: used to specify Apache provides the root directory of the page service. This path must be an absolute path rather than a relative path. If there are spaces, it needs to be enclosed in quotation marks.
4. ServerAdmin: The address to send an email to the administrator after a server error.
5, ServerAlias and Alias: are all used to map directories, but ServerAlias identifies the mapped directory as a CGI script directory and treats all files in this directory as CGI scripts. But Alias is just mapped to a normal directory
6, User and Group: used to define the user and user group used to run the apache child process
7, Listen: used to define the listening apache Port number
8, LoadModule command: used to load modules or target files LoadModule cgi_module modules/mod_cgi.so_module
9, ErrorDocument: Custom error page information ErrorDocument 500 "unknown error" ErrorDocument 404 "/var/server/www/cgi-bin/missing_404.pl" ErrorDocument 402 http://www.nicky.com/error_402.html
10. options: Determine which directories to use those features , these features are as follows:
None: The option command will not take effect
ExecCGI: Allows execution of CGI scripts in the current directory
Includes: Allows the use of SSI functions
IncludesNOEXEC: The SSI function is allowed, but the exec cgi and exec cmd functions are disabled.
Indexes: Enable the index function. For example, if a request is made to the directory URLz and there is no index file specified by the DirectoryIndex directive, the server will Automatically return a list of requested directory contents
FollowSymLinks: Allows the use of symbolic links in the current environment, but will be ignored in the Location container
All: Uses all features except MultiViews, also options The default parameters
MultiViews: used to start the multi-view function provided by the mod_negotiations module
11, ServerTokens: OS/Major/Full affects the detail of the error footer information, and is generally not recommended.
(2) Container part
1,
<ifmodule mpm_netware_module><br> DirectoryIndex index.html <br></ifmodule>
If loaded Enter then execute <ifmodule mpm_netware_module><br> DirectoryIndex index.html <br></ifmodule>
If not loaded, execute
2
Based on
<ifdefine proxy></ifdefine>
LoadModule proxy_module modules/libproxy.so
##
Order Deny,Allow
Deny from all
The above example disables access to the /var/apache/html directory. Any request to /var/apache/html will be rejectedIf you want the directory to use regular expressions, you need to add a ~
Order Deny,Allow
Allow from all
<p>4 <files> and <filesmatch><br>Files: only works on files, you can also use wildcards and [] and ~ in front of the regular expression to use regular expressions<br><code><br> Order Deny,Allow<br>Allow from All<br>
FilesMatch: Files without adding a ~ symbol<filesmatch><br>Order Deny,Allow<br>Allow from All<br></filesmatch>
5
<location></location>
Order Allow,Deny
Deny from All
If the URL starts with cgi, it will be rejected
In addition, you can also URL requests are mapped to the Apache module handler, for example, using the mod_status module: <location><br>SetHandler server-status<br></location>
If you use the above configuration. Then when accessing /server-status, Apache will hand over the connection to the mod_status module for processing and return an Apache server running status page
Container processing order issue:
Apache will process it first The Directory container (but Directory and .htaccess with regular expressions will not be processed,) then the Files and FilesMatch containers, and then the Location and LocationMatch containers
<location></location>
Order deny,allow
## Allow from All
> ;
##
Above For example, since Apache will process the <directory> container first, and the <location> container processed last will overwrite the previous Directory configuration, so www.json.com will be allowed to be accessed by users. If the containers are the same, they will be listed in dictionary order. Work from short to long. </location></directory>
linux video tutorial
The above is the detailed content of Apache service configuration explained in detail. For more information, please follow other related articles on the PHP Chinese website!

Apache is an open source web server software that is widely used in website hosting. Installation steps: 1. Install using the command line on Ubuntu; 2. The configuration file is located in /etc/apache2/apache2.conf or /etc/httpd/conf/httpd.conf. Through module extensions, Apache supports static and dynamic content hosting, optimizes performance and security.

Apache is still widely used, but its market share has dropped from more than 50% in 2010 to less than 30% in 2023. Its advantage lies in its stability and reliability, which is suitable for enterprise-level applications that require these characteristics; its disadvantage is that multi-process models consume a lot of resources under high concurrency, and Nginx performs better in high concurrency processing.

The core features of ApacheWebServer include modular design, virtual host configuration, security settings and performance optimization. 1) Modular design enables flexible extensions by loading different modules, such as mod_rewrite for URL rewriting. 2) Virtual host configuration allows multiple websites to be run on one server. 3) Security settings provide SSL/TLS encryption and access control. 4) Performance optimization involves enabling KeepAlive, adjusting MPM configuration, and enabling cache.

Reasons for Apache's continued importance include its diversity, flexibility, strong community support, widespread use and high reliability in enterprise-level applications, and continuous innovation in emerging technologies. Specifically, 1) The Apache project covers multiple fields from web servers to big data processing, providing rich solutions; 2) The global community of the Apache Software Foundation (ASF) provides continuous support and development momentum for the project; 3) Apache shows high stability and scalability in enterprise-level applications such as finance and telecommunications; 4) Apache continues to innovate in emerging technologies such as cloud computing and big data, such as breakthroughs from ApacheFlink and ApacheArrow.

Apache remains important in today's technology ecosystem. 1) In the fields of web services and big data processing, ApacheHTTPServer, Kafka and Hadoop are still the first choice. 2) In the future, we need to pay attention to cloud nativeization, performance optimization and ecosystem simplification to maintain competitiveness.

ApacheHTTPServer has a huge impact on WebHosting and content distribution. 1) Apache started in 1995 and quickly became the first choice in the market, providing modular design and flexibility. 2) In web hosting, Apache is widely used for stability and security and supports multiple operating systems. 3) In terms of content distribution, combining CDN use improves website speed and reliability. 4) Apache significantly improves website performance through performance optimization configurations such as content compression and cache headers.

Apache can serve HTML, CSS, JavaScript and other files. 1) Configure the virtual host and document root directory, 2) receive, process and return requests, 3) use .htaccess files to implement URL rewrite, 4) debug by checking permissions, viewing logs and testing configurations, 5) enable cache, compressing files, and adjusting KeepAlive settings to optimize performance.

ApacheHTTPServer has become a leader in the field of web servers for its modular design, high scalability, security and performance optimization. 1. Modular design supports various protocols and functions by loading different modules. 2. Highly scalable to adapt to the needs of small to large applications. 3. Security protects the website through mod_security and multiple authentication mechanisms. 4. Performance optimization improves loading speed through data compression and caching.


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

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Dreamweaver CS6
Visual web development tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

SublimeText3 Linux new version
SublimeText3 Linux latest version

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