What all is there Inside the Apache web server.

advertisement
What all is there Inside the
Apache web server.
These slides are part of study material of LAMP course.
Course conducted by
Prof Rocky Jagtiani – Technical Head – Suven Consultants
For any queries mail to : query@suvenconsultants.com
What all is there Inside the Apache web server
There are too many components / modules inside the web
server , only 10% is used at any point of time by the web
developers.
To look into the Apache web server , look into the conf file.
$ vi /etc/init.d/conf/httpd.conf
# for a ordinary user this file is read only.
$ su root
or
simply $ su , again open httpd.conf file.
The file has many sections.
Suven Consultants - Channel Partner - Monster India
2
Brief over view of the important sections of the Apache web server
The conf directives are grouped into three basic sections:
# 1.
Directives that control the operation of the Apache server
process as a whole (the 'global environment').
# 2.
Directives that define the parameters of the 'main' or 'default'
server, which responds to requests that aren't handled by a
virtual host. These directives also provide default values for the
settings of all virtual hosts.
# 3.
Settings for virtual hosts, which allow Web requests to be sent
to different IP addresses or hostnames and have them handled
by the same Apache server process.
Suven Consultants - Channel Partner - Monster India
3
Section 1: Global Environment
Section 1: Global Environment
# The directives in this section affect the overall operation of Apache,
such as the number of concurrent requests it can handle or where
is the location of the configuration files.
ServerRoot "/etc/httpd“
Indicates location of the apache server process.
PidFile run/httpd.pid
PidFile: The file in which the server should record its process
identification number when it starts.
Timeout 120
Timeout: The number of seconds before receives and sends time out.
Suven Consultants - Channel Partner - Monster India
4
Server-Pool Size Regulation (MPM specific)
prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# ServerLimit: maximum value for MaxClients for the lifetime of the server
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule prefork.c>
StartServers
MinSpareServers
MaxSpareServers
ServerLimit
MaxClients
MaxRequestsPerChild
</IfModule>
8
5
20
256
256
4000
Suven Consultants - Channel Partner - Monster India
5
worker MPM
# StartServers: initial number of server processes to start
# MaxClients: maximum number of simultaneous client connections
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule worker.c>
StartServers
MaxClients
MinSpareThreads
MaxSpareThreads
ThreadsPerChild 25
MaxRequestsPerChild
</IfModule>
2
150
25
75
0
Listen attribute : indicates the IP address and the port no. on which the apache web
server listens to.
Default IP : Port no.
12.34.56.78 : 80
Lastly this section indicates all the modules loaded at start up. “ LoadModule”
Suven Consultants - Channel Partner - Monster India
6
Section 2: 'Main' server configuration
The directives in this section set up the values used by the 'main' server, which
responds to any requests that aren't handled by a <VirtualHost> definition.
It also defines settings for the <VirtualHost> containers.
1> DocumentRoot = “ /var/www/html ” indicates the location where we would place
the web pages ( php files)
2> UserDir. This directory is the home directory of any individual user. For each
/home/< login name > there is a public_html folder at the web server. This folder
holds all the web pages to be visible to the entire world.
3> Permissions. Used to give the permission to UserDir. Like AllowAll , Allow,
AllowNone.
4> HostnameLookups. This feature is OFF by default. If ON , then for every request a
log is created in the table “HostnameLookups”
5> ErrorLog
logs/error_log this file logs all the errors.
6> LogLevel indicates the type of the message logged like warn, error, debug, info.
Suven Consultants - Channel Partner - Monster India
7
Section 3: Settings for virtual hosts, which allow Web requests to
be sent to different IP addresses or hostnames and have them
handled by the same Apache server process.
NameVirtualHost *:80
Indicates the port at which the virtual host would listen.
The attribute (in black colour) and the value (in the red colour)
<VirtualHost *:80>
ServerAdmin jagtiani_rocky@yahoo.com
DocumentRoot /var/www/html/labtest
Suven Consultants - Channel Partner - Monster India
8
<Directory /var/www/html/labtest>
DirectoryIndex index.php
AuthType Basic
AuthName "This is for test"
AuthUserFile /usr/httpdpassdir/passwords
Require user rocky suven
AllowOverride All
Order allow,deny
Allow from All
</Directory>
ServerName suvenconsultants.com
ErrorLog logs/labtest-error_log
CustomLog logs/testps-access_log combined
</VirtualHost>
Suven Consultants - Channel Partner - Monster India
9
Download