httpd.conf file annotations and configuration instructions for Apache server

Source: Internet
Author: User
Tags define log

We made a simple comment on the httpd.conf file, and here just put the annotations in it and make it easier to navigate

Before you start:

1, configure and Write file name Note: If you give a filename with "/" Start, then the server will use an absolute directory.

2, if the given filename does not start with "/", such as: "Logs/foo.log",

and the current server and directory is "/usr/local/apache/",

Then the server will think this log file is here: "/usr/local/apache/logs/foo.log"

3, note: Throughout the configuration process in all the file names should be used in the slash "/", without the backslash "\".

For example: Use "C:/apache" instead of "C:\apache", this is not the same as DOS.

The Apache server's configuration directives are divided into three relatively concentrated parts

1. Configure the environment variables for the Apache server during the entire run.

2. Configure the detailed interface parameters for the master server or default server runtime.

3. Set up a virtual server that enables Web requests to be completed with different IP addresses or different host names on the same Apache server

(That is, a physical server can be set to a virtual server with many IP addresses or many host names)

The first part: Environment setting

# Set the starting mode of the server: independent start-up (standalone), or by the Internet servo program inetd to start.

# The default value is to use standalone startup (standalone).

ServerType Standalone

# Set up the server directory to store the server's configuration files, error files, log files directory.

# Note: At the end of the table of contents you cannot add a slash '/'.

ServerRoot "C:/apache"

# When the service program starts, it saves the program code (process ID) of the parent program httpd to this

# log/httpd.pid file. This file name can be changed with pidfile instructions.

Pidfile Logs/httpd.pid

# Set up the log file for the Apache Server execution program.

Scoreboardfile Logs/apache_status

# below these two look personal preferences, if you think httpd.conf file is too long, difficult to find what you need.

# then you can put the desired setting in the srm.conf (it only has a few lines) and open it below:

# The two settings below are open in the standard configuration and we can not open it.

# to remove the "#" in front of the next line, enable srm.conf

#ResourceConfig conf/srm.conf

#AccessConfig conf/access.conf

# Maximum waiting time for servers and clients

# If the client is not connected in 300 seconds, or if the server has not transmitted data to the client for 300 seconds, it will be disconnected automatically. Timeout 300

# Set whether to support the continuation of the function. Default is Support

KeepAlive on

# Set the number of support continuous transfer functions. The more you waste your hard disk space, the better the performance.

# set to 0 there is no limit.

Maxkeepaliverequests 100

# Set the maximum waiting time for the guaranteed continuous transmission

# If a user on the connection has not made a request to the server after 15 seconds, he cannot use the resume function.

KeepAliveTimeout 15

# Set the number of processes at the same time, for security, set to 0.

Maxrequestsperchild 0

# Set the number of server usage processes.

# This is based on the server response speed, the number is too large will be slow.

Threadsperchild 50

# allows access to the server using a different port or IP address. You can open it.

#Listen 3000

#Listen 12.34.56.78:80

# Set the IP address of Apache listening, which is also the IP address of your virtual server on this computer.

Bindaddress 127.0.0.1

# Open a predefined module that is not currently activated, and don't change it unless you really need it

#LoadModule Anon_auth_module Modules/apachemoduleauthanon.dll

.

# Set the status information generated by the server. If set to on, detailed information is generated.

#ExtendedStatus on

The second part detailed interface parameter setting

# set up the ports that the server listens on when it is used independently.

Port 80

# Set up the email address of the Server Manager.

ServerAdmin siron@phpstar.com

# The host name of the server. If you have a fixed IP address, you do not need to set the

ServerName localhost

# Set the directory where the site HTML files are stored

DocumentRoot "C:/apache/htdocs"

# Settings/directory instructions. The details are as follows:

# Option: Defines the actions that can be performed within the directory.

# None means browse only.

# FollowSymLinks allows pages to be connected elsewhere,

# EXECCGI allows CGI to execute,

# multiviews allows you to watch animations or listen to music,

# indexes allows the server to return a formatted list of directories,

# includes allows SSI to be used.

# These settings can be checked. All can do anything but do not include multiviews.

# allowoverride:

The # Plus none parameter indicates that anyone can browse the file in the directory, but it will not read the file.

# FileInfo allows the use of instructions to control file types,

# authconfig allows the use of the verification instructions,

# Indexes allows the use of commands that control the index of the directory,

# Limit allows control of access to the use of the host's instructions,

# Options allow you to control the use of instructions that are unique to a particular directory.

# When set to all, the server will allow all instructions.

<directory/>

Ptions followsymlinks

AllowOverride None

</directory>

# defines the files that are displayed first.

# You can change DirectoryIndex index.html index.htm like this

DirectoryIndex index.html

# define the name of each directory access control file

Accessfilename. htaccess

# define proxy server do not cache your pages. Not used by default.

#CacheNegotiatedDocs

# This command sets the position of the MIME type configuration file,

# The file name is relative to the serverroot and it is not recommended to change the file.

Typesconfig Conf/mime.types

# The server will log the error message to a log file,

# file names can be set by ErrorLog directives.

# can set different error records for different virtual hosts

ErrorLog Logs/error.log

# Set the format of the log file

Logformat "%h%l%u%t \"%r\ "%>s%b" common

.

.

.

# Alias directive allows files to be stored in a local filesystem outside of DocumentRoot

# The scriptalias instruction is the same as the Alias directive, except that it also marks a change directory containing a CGI or PHP instruction file

# AddType The name of the file with the specified content type as the end of the file name

alias/icons/"c:/apache/icons/"

alias/test/"c:/php/test/"

alias/admin/"c:/admin/phpmyadmin/"

scriptalias/php/"c:/php/"

AddType application/x-httpd-php. php

AddType application/x-httpd-php3. php3

Action application/x-httpd-php "/php/php.exe"

# AddIcon, addiconbyencoding and Addiconbytype

# is used to set up a list of icons used to display different file types, for each column

# Out of the file type, showing the first conforming diagram listed.

Addiconbytype (vid,/icons/movie.gif) video/*

Addicon/icons/binary.gif. bin. exe

# The default file diagram

Defaulticon/icons/unknown.gif

# in the event of a problem or error, you can configure Apache to do four kinds of reactions

# 1. Output a custom (customized) message (text)

#ErrorDocument "The server made a boo boo.

# 2. Redirect to a local URL to handle the problem/error

#ErrorDocument 404/missing.html

#ErrorDocument 404/cgi-bin/missing_handler.pl

# 3. Redirect to an external URL to handle the problem/error

#ErrorDocument 402 http://some.other_server.com/subscription_info.html



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.