Presentation is loading. Please wait.

Presentation is loading. Please wait.

The features of Apache Apache’s qualities are its speed, configuration, stability, and rich features set . Apache is easy to configure & easy to reconfigure.

Similar presentations


Presentation on theme: "The features of Apache Apache’s qualities are its speed, configuration, stability, and rich features set . Apache is easy to configure & easy to reconfigure."— Presentation transcript:

1 The features of Apache Apache’s qualities are its speed, configuration, stability, and rich features set . Apache is easy to configure & easy to reconfigure too. Its configuration information resides in plain text file and uses simple English directives. Apache is open source software project so anyone can contribute source code. Apache is easily extensible using Dynamic Shared Objects (DOS) Apache has a rich set of access control & gives websites Administrator flexibility in choosing authentication mechanism.

2 It also supports virtual host known as multihomed – servers which enables single machine to provide web services for multiple domains or IP address. Apache enables administrator to define multiple directory index file, the default page to display when a web client request a directory URL.

3 Apache 2 Apache2 has multiprocessing modules(MPM) gives system administrator flexibility in deciding how apache will create & destroy multiple processes. -> Perchild: Master server starts multiple child processes, and each child server process can spawn a number of server threads. -> Prefork: Master server maintains a pool of idle spare servers that are started before they are needed (i.e. , are preforked) -> Worker: Like perchild, it starts multiple child server processes, and each child server process can spawm a number of server threads but it cannot assign child processes to multiple user ID’s.

4 Apache2 supports IPv6 on the system that have IPv6.
Apache2 has API(Application programming Interface) modules which removes manual requirement. HTTP error message generated by the server can be displayed in multiple languages using server side includes(SSI). Build system was rewritten to use standard GNU build tools (autoconf and libtool). Filters to modify httpd input or output stream can be implemented as modules, improving performance.

5 Working of Web Server The general purpose that takes place for the working of Web Server is Web Browser request a page & server(Apache) responds The Web Client firstly performs a DNS lookup on the server name specified in the URL, & obtain IP-address of the server(website) & then connect to port no 80 at that IP address. As soon as server receives the request,it translates the document URL into filename on the local system For eg:- might become /var/www/html/sports.html

6 Now as next step , Apache will evaluate whether the requested document is subject to some sort of access control . If no access control is required ,then apache satisfies the request & access is granted. If the requested URL specifies a directory rather than a specific document,Apache looks for directory index page i.e,index.html by default. If the directory index page does not exist ,Apache might send a directory listing a HTML format to the client or send an error message. Finally after Apache has transmitted the requested document & client receives it,the client closes the connection & Apache writes on entry in one or more log files.

7 Configuration File of Apache along with different Section
The basic layout of the configuration file of Apache i.e /etc/httpd/conf/httpd.conf is organised into 3 sections as follows:- Global Characteristics. Primary/Default server Virtual Host User has to configure all these three section in order to run successful Apache The Section are described as follows:

8 (1) Configuring Global Behaviour:-
The directive Timeout defines the maximum time an Apache waits for packet send and receive operation to complete.It is defined in seconds and default value is set to 120. The MaxKeepAliveRequests directive sets the number of requests permitted per connection.By default it supports 100 requests. The StartServers directive defines the number of child servers created when Apache starts.By default 8 child servers is created when Apache starts. The ServerLimit directive specifies the upper limit on the number of server processes of threads running simultaneously.By default upper limit is set to 256.

9 The MaxRequestPerChild directive defines the maximum number of request each child server fills before terminating.4000 is the default value. The LoadModule directive links the module or library filinames into the server and adds it to the list of active modules. The include directive includes the content of the files in conf.d/ whose name end in .conf. In the ServerRoot directive,name of the log files or additional files or additional files are appended.By default the fedora core set ServerRoot directive value as /etc/httpd.

10 It sets the default output character set used by Apache.
DEFAULT PARAMETERS Directive Values Description AccessFileName .htaccess It lists one filenames in the complete path to the requested document that define and control access to documents in each directory or subdirectory at the same level as or below the topmost directory where the file specified by AccessFileName is found. AddCharset Charset It adds the default charset to Apache’s list of supported character set. AddDefaultCharset UTF-8 It sets the default output character set used by Apache. :

11 Directive Values Description AddHandler Handler mimetype It is responsible to associates handler with the MIME type mimetype. AddIcon Icon name It maps the icon as the icon to display next to the files ending with name. It is used with FancyIndexing directive AddIconByEncoding Icon mimeencoding It maps the icon with file whose MIME encoding is mimeencoding. It is used with FancyIndexing AddLanguage Mimelang name It maps the filename extension specified by name to the MIME language mimelang overriding the previous mappings for name AddOutputFilter Output mimetype It associates an output filter for server output of type output with the MIME type mimetype AddType Mimetype name It adds the specified mimetype for files ending in name to the list of MIME typesread from the Typeconfig file

12 Directive Values Description
Alias Urlpath dirpath It maps the directory urlpath,specified relative to DocumentRoot, to the file system directory dirpath otherwise inaccessible because all content must be under DocumentRoot. CustomLog Logs/access_log combined It defines the name of the Apache's log and the log format used when logging requests to the server. DefaultIcon /icons/unknown.gif It sets the default icon displayed next to the files whose MIME or content type cannot be determined. It is used with FancyInexing directive. Default Type Text/plain It defines the default MIME type when a requested document’s MIME type cannot be determined using the TypesConfig of AddType directives. <Directory dirname> </directory> Directives It delimits a set of configuration directives that apply to dirname and its subdirectories

13 Directive Values Description
DirectoryIndex Filename It specifies one or more filename that can serve as a directory index when a request does not specify a particular file or document. DirectoryRoot “/var/www/html” It sets the base directory from which all requested documents are served. The documents URL are interpreted. ErrorLog Logs/error_log It defines the name of Apache’s error log relative to ServerRoot, it the file name does not begin with / ForceLanguagePriority It uses the values specified in LanguagePriority to return a valid result. Fallback returns a valid choice from those listed in LanguagePriority and Prefers returns language specified by the client. Group[#] Apache It specifies the group name or if prefixed with #, the GID under which child servers execute. HeaderName Header.html It defines the HEADER.html as the file whose contents are inserted at the top of the directory listing.

14 Directive Values Description
HostnameLookups Off It controls whether Apache performs DNSloopkups on connecting hosts in order to log hostnames. indexIgnore Filespec It defines one or more filename patterns filespec that the directory indexer ignores. indexOPtions Opts It sets the options controlling the behaviour of Apache’s directory indexing features. LanguagePriority Spec It specifies a list of language code in spec that indicates the order in which languages codes is applied during content regotiotion. LogFormat Str name It defines the log format str named name, which is used by Apache for messages it lost in the access log LogLevel Warn It controls the amount and detail of information Apache records in it log ReadmeName README.html It defines README.html as the file whose contents are appended to the end of a directory listing

15 Directive Values Description ScriptAlias UrlPath dirpath It functions exactly like Alias directive and also indicates that dispatch contains executable CGI scripts ServerAdmin It defines the address included in error message displayed to client connections ServerName It specifies an alternative name for the servername.

16 Configuring Virtual Servers section
This section consists of the directives that are required to make settings for virtual hosts. It allows configuration through which web requests is sent to different addresses or hostnames that are handled by the same Apache server process. Virtual hosts can be categorized in two forms. IP-based virtual hosts and name based virtual hosts.

17 Below table shows the list of directives used to configure the virtual servers and their description.

18 . Directives Description <VirtualHostipaddr[:port]> directives
It defines a virtual host whose IP address is addr. This directives are one or more of the directives listed previously and override the directives listed on them. NameVirtualHost ipddr [:port] It defines the IP address addr for a name-based virtual host. ServerAlias altname It enables the virtual server to repond to one or many alternate hostnames altname when used with name-based virtual hosts. A single VirtualHost drirective can have multiple ServerAlias statements. ServerName fqdn It sets the name of the virtual server to the FQDN fqdn.

19 What is SSI? SSI(Server Side Include) allows to add dynamically generated content to an existing web page.

20 Steps to enable SSI Enable support for SSI is done using the following statement in <Directory> Block

21 < Directory/var/www/>
Option Indexes FollowSymlinks include Allow Override None Order allow , deny Allow from all Addtype text/html.shtml </Directory>

22 Explanation of above statements:
Indexes : Instruct server to return index page as mentioned in DirectoryIndex, directive. Followsymlink : Enables the server to follow symbolic link in this directory. Includes : Enables SSI.

23 Allow Override : Group of directives are overridden
Allow Override : Group of directives are overridden. Possible values are None. Order deny, allow : Evaluates deny directive and then allow directive. Order allow, deny : Evaluate allow directory and then deny directive. AddType : Type of scripts to be Added / allowed i.e., .html, .shtml, .cgi, .pl etc.

24 A file containing <directory> tag suppose for eg : test
A file containing <directory> tag suppose for eg : test.conf, must be situated in this path -> /etc/httpd/conf.d/ SSI directive look like html comment, they take the following general form, <!-element attribute = value--> To create an SSI file, create a webpage as shown below with .shtml extension and place it in /var/www/html.

25 For eg: <html> <head> <title> SSI Page </title> </head> <body> <!--#exec cmd = “date”--> <!--#include virtual=“hello.html”--> </body> </html>

26 Now open the page in the browser as, http://localhost/tests/ssi.shtml
Where ssi.shtml is the name of SSI page

27 CGI in Apache CGI , Common Gateway Interface, is a protocol that defines a standard method for enabling web server to communicate with external dynamic programs also called as CGI scripts. The CGI scripts are most commonly used to make web pages dynamic. CGI is more flexible than SGI as it provides additional functionality that SSI cannot support. For eg; CGI scripts can be used for user authentication etc.

28 To enable CGI on Web Server, make sure that Apache’s configuration file permits CGI scripts execution: i.e, #vim /etc/httpd/conf/httpd.conf & then check, ScriptAlias /cgi-bin/”/var/www/cgi-bin” The above directive tells Apache that URL beginning with /cgi-bin/ should be served from /var/www/cgi-bin/ In cgi file, command print & system are used to display the output. After creating CGI file, save the script as cgitest.pl & make it executable, i.e, chmod 777 cgitest.pl & put it in /var/www/cgi-bin. Now, browse the file as URL:

29 Following is the eg of sample CGI script:
#!/usr/bin/perl Print ‘content-type:text/html’; print’<html>’; print’<head>’ print’<title>welcome to cgi page</title>’; print’<body>’; print’<p>CGI demo page</p>’; system’date’; system’ls-l’; System’cat /var/www/html/tests/newpage.html; print’</body>’; print’</html>’;

30 Enabling PHP PHP is widely used in HTML scripting languages.
PHP directive in HTML pages starts with ‘<?’ & ends as ‘?>’ Include is used to include any external file & system to display o/p. Create a sample PHP page as shown below under /var/www/html/tests & save it as phpdemo.php <html> <head> <title>PHP page</title> </head>

31 <body> <p>PHP test page </p> <? system(ls-l”); system(“date”); include<“newpage.html”); ?> </body> <html>

32 Run PHP test script phpdemo
Run PHP test script phpdemo.php in the web browser and verify PHP is properly configured and working or not.

33 SSL & Creating secure server with SSL
Data that is exchanged through web pages during ecommerce must be made secure. SSL(Secure Socket Layer) enabled website encrypts requested document. To enable and encrypt communication between server and client, there is a need to configure secure web server using SSL.

34 Server Certificates SSL works using a key pair to encrypt and decrypt data, of which one key is public and other private. Certificates are used to verify the data sent and received through the server. Public key encrypt the data on webpage and only its corresponding private key decrypts the data. Digital certificate works on the principle of encryption and trust. SSL, encrypts the communication between webserver and client to ensure that data exchange is altered. Encryption increases difficulty of deciphering captured data stream.

35 Digital certificate provides a level of assurance or trust that the identities behind web server and web client are genuine. A digital certificate contains following information: Owner’s address Owner’s name How long certificate can be used How long the certificate is valid Website’s URL for whom certificate issued Public keys associated with certificate Message digest

36 Digital certificate comes in two flavours:
Signed by CA(A Certificate authority). Self-signed certificate Steps to create self-signed certificates: Change your current directory to directory as #cd/etc/pki/tls/certs Create a key pair #make genkey If certificate is to be obtained from CA, then create/generate signing request as; #make certreq Else create a self signed certificate as, #make testcert Finally restart the service of apache #service httpd restart

37 Configuring Apache Server
Apache is Linux webserver used to create inexpensive and stable server. Following are the steps required to configure Apache. Verify httpd is installed on the system on the system as, #rpmquery httpd Edit the configuration file of Apache i.e, /etc/httpd/conf/httpd.conf to add following lines to represent Virtual Host; i.e, <VirtualHost name of website:80> Documentroot/var/www/html/Servername name of website </VirtualHost>

38 Start/Restart the service of apache:
#service httpd restart Enable apache on boot: #chkconfig httpd on Test the website hosted by apache in the browser: Application ->Internet ->Firefox ,then type URL, say, of website


Download ppt "The features of Apache Apache’s qualities are its speed, configuration, stability, and rich features set . Apache is easy to configure & easy to reconfigure."

Similar presentations


Ads by Google