Linuxhttpd. conf file configuration

Source: Internet
Author: User
Article Title: linuxhttpd. conf file configuration details. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

The basic settings of Apache are mainly managed by httpd. conf. We need to modify the related settings of Apache by modifying httpd. conf. Let's take a look at the content of httpd. conf, which is mainly divided into three parts:

Section 1: Global Environment

Section 2: 'main' server configuration

Section 3: Virtual Hosts

[Part 1]

· ServerType standalone

This indicates that Apache is started with standalone or inetd. The so-called standalone refers to starting a connection to answer all connections at a time, while the inetd is started only when it is required to connect to the http connection. As the connection ends, is it a great burden? Therefore, it is generally started with standalone.

· ServerRoot "/usr/local/httpd"

This is the apache directory.

· # LocdFile/use/local/httpd/logs/httpd. lock

Retain the default value. Do not change the value.

· PidFile/usr/local/httpd/logs/httpd. pid

This file records the id of the apache parent Handler

· ScoreBoardFile/usr/local/httpd/logs/httpd. scoreboard

Information of this file storage Handler

· # ResourceConfig conf/srm. conf

· # AccessConfig conf/access. conf

Because httpd. conf is used for overall management, the preset values of these two files are annotated and can be kept unchanged.

· Timeout 300

Set the staring timeout time. If the client has not connected to the server for more than 300 seconds, or the server has not sent information to the client for more than 300 seconds, it is disconnected.

· KeepAlive On

Allow connections on the client to have multiple requests. If this parameter is set to Off, the connection is not allowed.

· MaxKeepAliveRequests 100

The larger the number, the better the efficiency of the tree with the largest request for each connection. 0 indicates no restriction

· MinSpareServer 5

· MaxSpareServers 10

MinSpareServer 5 indicates that there will be at least five idle handlers. If the actual number is less than this number, the handler will be added. MaxSpareServers 10 indicates the maximum number of idle processors. If your website is in high demand, you can increase the number.

· StartServers 5

Number of servers at startup

MaxClients 150

Limit the maximum number of connections at the same time. Of course, it cannot be set too small. Once this number is reached, no more users can be added.

· MaxRequestPerChild 0

Limit the number of pre-processing results. 0 indicates no limit.

· # Listen 3000

· # Listen 12.34.56.78: 80

Use other connection ports or IP addresses

· BindAddress *

You can answer * (all IP addresses), the specified IP address, or the complete domain name.

· # LoadModule foo_module libexec/mod_foo.so

Use DSO Module

· # ExtendedStatus On

View apache status information. The default value is Off (Annotated)

[Part 2]

If the previous ServerType is inetd, Jump directly to ServerAdmin.

· Port 80

The connection port that the Standalone server receives. Of course, it can also be another port number smaller than 1023.

· User nobody

· Group nobody

Users and groups executing httpd

· ServerAdmin

Administrator email address

This is the administrator's email address. If apache is faulty, it will send a message to the Administrator. Of course, you can also create a web account to receive emails.

· ServerName

Your host name

This is the host name. If there is no domain name, you can also use an IP address

· DocumentRoot "usr/local/httpd/htdocs"

This directory is the place where apacheis set up. The index.html in this directory is the default homepage connected to this host.

·

Options FollowSymLinks

AllowOverride none

This directory sets the execution action of the directory (public_html) where the user places the webpage. The detailed directory access method will be described later

·

Options Indexes FolloeSymLinks

AllowOverride None

Order allow, deny

Allow from all

This directory sets the running action of apache's web directory (htdocs)

· UserDir public_html

You can create a public_html directory in your own directory to place webpages. Enter http: // host address /~ The user name can be connected? /A>

· DirectoryIndex index.html

Set the default homepage name.

· AccessFileName. htaccess

This is the name of the file that controls access. The default. htaccess name is generally used. The following describes how to use htaccess.

·

Order allow, deny

Deny from all

This is used to prevent others from seeing the content of files starting with. ht. It not only protects the content of. htaccess, but also protects the content of. htpasswd. Of course, it can also be written directly. If you have changed the AccessFilename, for example, to change. htaccess to. accessht, remember to make relevant changes here to prevent others from seeing it.

· # CacheNegotiatedDocs

The annotation tells the Proxy not to store the file generated by the interaction into the cache. If you remove #, it will exist in the cache.

· UseCanonicalName On

Use the standard name. The default value is On. Assume that the full name of a web server is www.sample.com, which is generally called www. If we ...? Ttp: // www/abc

· TypeConfig/usr/local/httpd/conf/mime. types

Specifies the object that stores the MIME file type. You can edit the mime. types file by yourself.

· DefaultType text/plain

The default format when the server does not recognize this file type.

·

MIMEMagicFile/usr/local/httpd/conf/magic

The mod_mime_magic module enables the server to determine its MIME type based on the file content. If the mod_mime_magic module is loaded, the MIMEMagicFile segment will be processed. If it is ..., It indicates that if the module is not loaded, the process will be processed.

· HostLookups Off

If it is On, the IP address will be resolved to the name server each time, and the name of the connection line (for example, www.apache.org) will be record as self-changing, and only the IP address will be recorded.

· ErrorLog/usr/local/httpd/logs/error_log

Specify the location of the Error Log File (error_log. If no error record file is specified, the file will be used

· LogLevel warn

[1] [2] [3] Next page

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.