Article title: AdministeringApache reading notes. 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.
Modules-> Functions
Install and configure apache
######################################## ######################################## ###########
Obtain apache
Get apache 2.0.44 from http://www.apache.org
Install apache
------------------------------
Use APACI to configure apache installation:
./Configura
Common options:
-- Help # View all available options
-- Prefix = # Specify the installation directory
-- Enable-module = # Xxx is the module named mod_xxx.c
-- Disable-module = xxx # xxx is the module named mod_xxx.c.
-- Enable-shared = # DSO (Dynamic Share Object) must be supported by mod_so.c.
Start Installation
-------------------------------------------------------------------
Make
Make install
Oks
Integration with php 4.3.1
-------------------------------------------------------------------
---/Configure -- with-apxs2 =/usr/local/apache2/bin/apxs <假如想安装mysql的话 --with-mysql="/usr/local/mysql">
Make
Make install
Configure apache
-------------------------------------------------------------------
The main configuration file of apache:
Httpd. conf
Srm. conf
Access. conf
Mime. types
Magic
Edit httpd. conf
Basic commands:
ServerType # standalone or inetd
ServerRoot # apache installation directory. the default value is/usr/local/apache.
LockFile # lock file location in server serial mode, which does not need to be changed
PidFile # file path that records the pid of the server runtime
ResourceConfig # when the resource file is located and srm. conf is empty, the value of httpd. conf takes effect.
AccessConfig # path of the access permission file
LoadModule # load module
AddModule # sequence of loading modules
Port # The listening Port. the default value is 80.
ServerAdmin # administrator mailbox
ServerName # Server Name
DocumentRoot # path of the website file
Test whether the configuration is correct
-------------------------------------------------------------------
Apachectl configtest
Start apache
-------------------------------------------------------------------
Apachectl start or httpd-k start
Restart apache
-------------------------------------------------------------------
Apachectl graceful or httpd-k graceful
Stop apache
-------------------------------------------------------------------
Apachectl stop or httpd-k stop
Create a web site
######################################## ######################################## ###########
The default user and group of apache is apache.
Grant the directory and file permissions of the site to apache
Find/usr/local/apache/-exec chown apache {} find/usr/local/apache/chgrp apache {} find/usr/local/apache/-type-d chmod 755 {} find/usr/local/apache/-type-f chmod 640 {} it is the responsibility of an administrator to grant appropriate permissions to appropriate files.
Directory content processing
-------------------------------------------------------------------
DirectoryIndex index.htm index.html # default text block
If the default document does not exist, and Indexes in Options takes effect:
HeaderName # Page header file
ReadmeName # Page tail file
IndexIgnore # hide file rules
IndexOptions # control the appearance of the directory list
Other directories
-------------------------------------------------------------------
Alias/path /"/ /"# Alias definition
Configure MIME (multipropuse internet mail extend protocol)
-------------------------------------------------------------------
Because it is not often modified, only browsing
AddHandler
SetHandler send-as-is # send as original
Configure SSI
-------------------------------------------------------------------
Because Dean Gaudet, an apache performance expert, does not encourage SSI, I just browsed it and did not record it in detail.
Use log
######################################## ######################################## ###########
-------------------------------------------------------------------
LogLevel Simple --> serious details --> Minor
ErrorLog
Log sent to File: ErrorLog/var/www/log
Log sent to syslog: ErrorLog syslog: local <1-7> default value: local 7
The log is sent to the pipeline: ErrorLog "|/usr/local/apache/bin/errordb insert"
Log transmission
-------------------------------------------------------------------
The document transfer log tells you who the server is interacting with, what to interact with, when to interact with, and where to interact with TransferLog usage similar to ErrorLog
Custom log format
-------------------------------------------------------------------
LogFormat
% A client ip
% A server ip
% B number of bytes other than the http header returned
% {Eviron} e value of the variable named after eviron
% F path of the requested file
% H client hostname
% {Reqheader} the value of the header whose name is reheader
% L client system environment, IdentifyCheck is On, and content negotiation is successful
% {Modnote} n value of the SMS whose name is modnote
% P server port
% P server PID
The first line of the % r request, including URLmodth
% S original response information
%> S return the browser response status
% T request occurrence time [18/Nov? 1999: 13: 02: 58-0600]
% {Timefmt} t defines the display format of the time. it is omitted because it does not need to be modified...
% T number of seconds for processing requests
Login name of the user requested by % u
URL requested by % U, excluding parameters
% V server name
% V obtain the server name based on UseCanonicalName
The default format of common logs is equivalent
LogFormat "% h % l % u % t \" % r \ "%> s % B"
LogFormat "% 401u" # Record unauthenticated user names
As long as the Condition is checked, the variable named VarName is defined.
Condition is a Regular Expression (Regular Expression) in unix. you can view man regex for details.
LogFormat CustomLog provided by mod_log_config.c <默认>
Provided by SentEnvIf mod_setenvif.c <默认>
CookieTracking CookieName CookieExpires
-------------------------------------------------------------------
Provided by mod_usertrack.c <非默认>
CookieTracking
CookieName myCookie
CookieExpires 600 # You can also use CookieExpires "3 weeks 2 days 4 hours 22 seconds"
Note that CookieExpires cannot be stored in , This option is global
AllowOverride
-------------------------------------------------------------------
All allows. htaccess to overwrite All directory settings in httpd. conf.
Authconfig allows overwrite authentication command AuthName AuthType AuthUserFile AuthGroupFile and so on
FileInfo allows overwrite directory access file setting AddEncodeing AddLanguage AddType CookieTracking CookieName and so on
Indexes allows overwriting directory index settings
Limit allows overwrite allow deny order require
None cannot overwrite all directory settings in httpd. conf.
Options allows override of Options Settings
Example: click a stream event, reference record, and proxy record.
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.