Apache's basic settings
Changc published on December 16, 2004
Apache's basic settings Apache's basic settings are mainly handed over to httpd.conf to set management, we want to modify the relevant settings of Apache, mainly by modifying httpd.cong. Let's take a look at the content of httpd.conf, which is mainly divided into 3: section 1: Global Environment Section 2: 'Main' Server Configuration Section 3: Virtual Hosts [Part 1] · Servertype Standalone This means Apache is STANDALONE Start, or inetd. The so-called STANDALONE means that all connects are started at once; and inetd is connected to the HTTP service to start. As the connection ends, is this burden? So it is usually started with Standalone. · Serverroot "/ usr / local / httpd" This is a directory of apache. # LOCDFILE /USE/local/httpd/logs/httpd.lock reserves the preset value, does not change the PIDFILE / USR / local / httpd / logs / httpd .PID This file records Apache's parent handler ID · scoreboardfile /usr/local/httpd/logs/httpd.scoreboard This file storage handler information · # resourceconfig conf / srm.conf · # accessconfig conf / access.conf due to We coordinate by httpd.conf, so the preset of these two files is annotated, and the preset value does not change the timeout 300 to the timeout time. If the user is more than 300 seconds, it is not connected to the server, or the server has not transmitted information to the user, that is, the line. · Keepalive ON allows the user to connect a number of requests, setting to OFF means that it is not allowed. MaxkeepAliveRequests 100 The maximum request tree is asked for each connection, the bigger the number, the better. 0 Indicates that • MINSPareServer 5 · MaxSpareServers 10 MinsPareServer 5 indicates that there will be 5 idle handles, and if the actual number is less than this, the handler will increase. MaxSpareServers 10 indicates the maximum number of idle processing programs, if your site is very demanding, you can set this number, big or just set this number too much. · STARTSERVERS 5 When the number of SERVER, the maximum number of server is limited to time. Of course, it cannot be set too small. Once this is reached, it is no longer able to increase the number of requests before the subscriber, MaxRequestperChild 0 restrictions, 0 means not restricted · # listen 3000 · # listen 12.34.56.78:80 Using other connection ports or ip · bindaddress * to answer * (all IP addresses), specified IP address or complete domain name · # loadingModule Foo_Module LibExec / MOD_FOO.SO Using the DSO Module · # ExtendedStatus ON to review the status information of Apache, the preset is OFF (Note) [Part 2] If the previous Servertype is inetd, please jump directly to ServerAdmin.
• Port 80 Standalone server answering connection port, of course, can also be other port numbers of other than 1023 • User Nobody · Group Nobody executes HTTPD users and group · ServerAdmin admin sports email address this is an administrator's email address, If Apache has problems, send a letter to notify the administrator, of course, you can also create a account for the account to receive the account. ServerName Your host name This is the host name. If there is no domain name, you can use IP · DocumentRoot "usr / local / httpd / htdocs "This directory is placed on the Apache where the index.html is connected to the preset home page of this host. Options FollowSymlinks willowoverride None This directory sets the user's directory (public_html) action. Detailed directory access method will be described later. · Options Indexes Folloesymlinks Allowoverride None ORDER ALINKS ALOWOVERRIDE NONE ORDER ALINKS ALOWOVERRIDE NONE ORDER ALLINKS ALOWOVERRIDE NONE ORDER ALLINKS ALOWOVERRIDE NONE ORDER ALLINKS ALOWOVERRIDE NONE ORDER ALLINKS ALOWOW FROM ALL This directory setting Apache's web directory (HTDOCS) execution action • UserDir public_html users can create public_html directories in their own directory To place the web page, enter the http: // host address / ~ user name to connect to the home page. The preset value public_html or WWW is used as a directory name. Of course, you can also use other names, but remember to tell the user, don't know where the web is placed. AccessFileName .htaccess This is the name of the file that controls access. Generally, the preset .htaccess name, will explain the use of HTACCESS · Order allow, Deny deny from all, this is used to prevent other people from seeing. HT Not only is it to protect .htaccess content, but also protect the .htpasswd content. Of course, you can also write directly. If you have change accessFileName, for example, .htaccess is changed to .accessHT, please remember to do related changes here, so that others will prevent others. · # CachenegotiatedDocs annotations are telling Proxy not to save interactive files Cache, if you take off #, there will be a name of the standard name in cache, and the preset is ON. Assuming a full name of a web server is www.sample.com, generally known as WWW; if UsecanonicalName is ON, the user enters http: // www / abc, it will be connected to http://www.sample.com/abc If it is OFF, it will be connected to http: // www / abc · typeconfig /usr/local/httpd/conf/mime.types to specify files that store the MIME file type. You can edit the MIME.TYPES file by yourself. · DefaultType Text / Plain When Server does not recognize the preset format of this file type, this setting is a general text • MIMEMAGICFILE / USR / local / httpd / conf / magic mod_mime_magic module allows Server to determine its MIME type by file content. If there is an MOD_MIME_MAGIC module to process the MIMEMAGICFILE.
If it is ..., it means that this paragraph will be processed if it is not loaded. ORG) naturally consumes a lot of time, so it is generally set to OFF, only the IP · ERRORLOG / USR / local / httpd / logs / irer / local / httpd / logs / error_log specifies the wrong record file (ERROR_LOG) location. If there is no error record file, it will be divided into many grades along this file. Each level is as follows: Level Description Debug debug information info normal information NOTICE Important WARN WARN Warning Error Error CRIT Emergency Alert About Amerg System is going to die · logformat "% h% L% u% T /"% R / "%> S% B /" {referer} I / "/" "combined logformat"% h% l% u% t "% r /"%> s% B "common logformat" % {Referer} i ->% u "refere logformat"% {user-agent} i "Agent custom four record format: combined, common, refrer, agent · customlog / usr / local / httpd / logs / access_log Common Recording file (Access_log) Using Customed CommON Format · # Customlog / USR / local / httpd / logs / usr_log referer #customLog / USR / local / httpd / logs / agent_log agent #CustomLog / USR / local / httpd / logs / agent_log combined These three record files are also using custom formats (which is Referer, Agent, Combined), but the web page generated in Server when not using these three files · Serversignature ON, " On the error occurred, there will be a line of Apache, the host, and the port of the connection; if you set it to email, there will be mailto: to the administrator's hyperlink · Alias / icons / "/ usr / local / httpd / icons / "Use a shorter alias, its format is: Alias alias for the original name. · Scriptalias / cgi-bin / "/ usr / local / httpd / cgi-bin /", like Alias, just this is a directory of Server Script · IndexOptions FancyIndexing Shows a good-viewed file list (with graphics corresponding to each file below) ) · Addiconbyencoding (cmp, / icons / compressed.gif) x-conpress x-gzip · addicon /icons/blank.gif ^^ ^blankicon22Defaulticon/icons/unknow.gif These are in the display file list (previously said When FancyIndex, the corresponding graphic of various file types.