In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
Today, the editor will bring you an article on Apache service configuration. The editor thinks it's pretty good, so I'll share it for you as a reference. Let's follow the editor and have a look.
Apahce configuration instructions can be divided into two blocks, the core instruction and the instruction provided by the third party. In apache, each instruction corresponds to a module, and the most important of all modules are core_module,so_module,http_module and mpm modules, which can not be turned off or disabled except so_moudle.
One: httpd.conf
(1) Master server part
1. ServerName: define the default host name of apache, which can be a domain name or an 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 the root directory where apache provides page services. This path must be an absolute path rather than a relative path, and should be enclosed in quotation marks if there are spaces.
4. ServerAdmin: the address of the email sent to the administrator after the server error
5. ServerAlias and Alias: both are used to map directories, except that ServerAlias recognizes the mapped directory as a CGI script directory and treats all files in this directory as CGI scripts. But Alias is only mapped to a normal directory
6. User and Group: used to define users and user groups used to run apache child processes
7. Listen: the port number used to define the listening apache
8. LoadModule instruction: used to load module or object file LoadModule cgi_module modules/mod_cgi.so_module
9. ErrorDocument: self-righteous 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: decide which features to use in which directories, as follows:
None: the option instruction will not work
ExecCGI: allows CGI scripts to be executed in the current directory
Includes: allow the use of SSI functionality
IncludesNOEXEC: SSI feature is allowed, but exec cgi and exec cmd feature is disabled
Indexes: enable the indexing function. For example, if a request to the directory URLz does not have an index file specified by the DirectoryIndex directive, the server will automatically return a list of the contents of the requested directory.
FollowSymLinks: symbolic connections are allowed in the current environment, but are ignored in the Location container
All: uses all the features except MultiViews and is the default parameter for options
MultiViews: used to start the multi-focus map function provided by the mod_negotiations module
11. ServerTokens: OS/Major/Full affects the detail level of error footer information, and is generally not recommended
(2) Container part
1. Container: if the container acts on the module, he will first judge whether the module is loaded, and then decide whether to process it, that is, the instructions in the container will be executed only if the result is true, on the contrary, if it is false, it will be ignored. You can use or to determine whether the module is loaded or not.
DirctoryIndex index.html
Execute if loaded
DirctoryIndex index.html
Execute if it is not loaded
2 container: encapsulates a set of instructions that take effect only when the condition is true, which acts on server config, virtual host, directory, .htaccess. The difference from IfModule is that it is judged by whether the module is loaded, but IfDefine is judged by conditions.
According to
LoadModule proxy_module modules/libproxy.so
3 containers:
Directory: let its encapsulated instructions work in its specified directory or its subdirectory, which must be a complete path, of course, you can also use the wildcard *? Match the directory, also consider using [] to determine the character range, but neither can match /
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 rejected
If you want the directory to use regular expressions, you need to precede it with a ~
Order Deny,Allow
Allow from all
DirectoryMatch: similar to Directory, except that it can directly accept regular matching without adding a ~ symbol.
Order Deny,Allow
Allow from all
4 and
Files: works only on files, or you can use wildcards and [] and before regular expressions ~ to use regular expressions
Order Deny,Allow
Allow from All
FilesMatch: Files without adding a ~ symbol
Order Deny,Allow
Allow from All
5 and: only access control for URL
Order Allow,Deny
Deny from All
If you start with cgi, URL will be rejected
You can also map URL requests to Apache module processors, such as using the mod_status module:
SetHandler server-status
If you use the above configuration. Then accessing / server-status,apache will hand over the connection to the mod_status module and return an Apache server running status page
Container processing order problem:
Apache gives priority to Directory containers (but not Directory and .htaccess with regular expressions), followed by Files and FilesMatch containers, followed by Location and LocationMatch containers
Order deny,allow
Allow from All
Order allow,deny
Allow from All
Deny from www.jons.com
In the above example, because Apache will process the container first, and the last container will overwrite the previous Directory configuration, it will be allowed to be accessed by the user for www.json.com. If the container is the same, it will be processed from short to long in dictionary order.
These are the details of the Apache service configuration. Have you learned anything after reading it? If you want to know more about it, you are welcome to follow the industry information!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.