Presentation is loading. Please wait.

Presentation is loading. Please wait.

Unit-5 Chap-1 Configuring Web Server

Similar presentations


Presentation on theme: "Unit-5 Chap-1 Configuring Web Server"— Presentation transcript:

1 Unit-5 Chap-1 Configuring Web Server
Created by : Ashish Shah, J.M. PATEL COLLEGE Unit-5 Chap-1 Configuring Web Server

2 Created by : Ashish Shah, J.M. PATEL COLLEGE
Apache Server The Apache Web server is the most popular Web server on the planet. Individuals and organizations use Linux primarily to create an inexpensive and stable Web server. The Apache Web server’s origins are the National Center for Supercomputing Applications (NCSA) HTTP server.

3 Apache transmits a document according to a client’s request.
Created by : Ashish Shah, J.M. PATEL COLLEGE HOW APACHE WORKS? Apache transmits a document according to a client’s request.

4 Created by : Ashish Shah, J.M. PATEL COLLEGE
Configuring Apache It is done in /etc/httpd/conf/httpd.conf file under 3 section : 1) config. Apache’s global characteristics 2) config. Of primary or default server 3) config. Of virtual hosts.

5 Apache’s configuration-sec-1
Created by : Ashish Shah, J.M. PATEL COLLEGE Apache’s configuration-sec-1 Depending on the installation profile you chose when you installed Fedora Core or RHEL, Apache might or might not be installed. To find out, use the rpmquery command shown in the following example. If the output is similar, Apache is installed: $ rpmquery httpd{,-{manual,devel }} httpd httpd-manual httpd-devel

6 Apache’s configuration-sec-1
Created by : Ashish Shah, J.M. PATEL COLLEGE Include conf.d/*.conf Includes the contents of the files in conf.d/ whose names end in .conf KeepAlive Off If set to On, maintains an open connection to a remote client in the absence of direct contact for the time specified by KeepAliveTimeout KeepAliveTimeout 15 Sets the number of seconds permitted to elapse between direct requests from the same client on the same connection before the server will close the connection (applies if KeepAlive is On) Listen [ipaddress:]80 Determines the combination of IP address and port on which Apache listens for connections; multiple Listen directives may be used LoadModule Links the module or library filename into the modname filename server and adds it to the list of active modules using the name modname MaxClients 256 Sets the maximum number of simultaneous connections supported MaxKeepAliveRequests 100 Sets the number of requests permitted per connection MaxRequestsPerChild 4000 Sets the maximum number of requests each child server fills before terminating MaxSpareServers 20 Defines the maximum number of spare (idle) child servers the master server spawns MinSpareServers 5 Defines the minimum number of spare (idle) child servers permitted PidFile run/httpd.pid Defines the file containing the PID of the master server process, relative to ServerRoot

7 Apache’s configuration-sec-1
Created by : Ashish Shah, J.M. PATEL COLLEGE ServerLimit 256 Specifies the upper limit on the number of server processes or threads running simultaneously ServerRoot /etc/httpd Defines the top-level directory for Apache’s configuration files and log files ServerTokens OS Defines the contents of the server’s HTTP response header StartServers 8 Defines the number of child servers created when Apache starts Timeout 120 Defines the maximum time in seconds Apache waits for packet send and receive operations to complete

8 Apache’s configuration-sec-1 (it is w.r.t. fedora’s global config.)
Created by : Ashish Shah, J.M. PATEL COLLEGE

9 Apache’s configuration-sec-2
Created by : Ashish Shah, J.M. PATEL COLLEGE Apache’s configuration-sec-2 Apache has a notion of a default or primary server, which refers to the httpd server that responds to any HTTP requests not handled by virtual hosts, also known as virtual servers. Without going into detail yet, a virtual server or virtual host is an httpd process running on the same machine as the default server, which is distinguished from the primary server by the hostname or IP address assigned to the virtual host. Despite the distinction between primary and virtual servers, configuration directives defined for the primary server also apply to virtual servers unless specifically overridden.

10 Created by : Ashish Shah, J.M. PATEL COLLEGE
Default server config. AccessFileName .htaccess : Lists one or more 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(s) specified by AccessFileName (if any) is found.

11 Created by : Ashish Shah, J.M. PATEL COLLEGE
Default server config. AddCharset charset : Adds the character set charset to Apache’s list of supported character sets AddDefaultCharset : UTF-8 Sets the default output character set Apache uses if no character set is requested by browsers or specified in HTTP request headers AddHandler : handler Associates handler with the MIME type mimetype mimetype AddIcon : icon name Maps icon as the icon to display next to files ending with name; used with the FancyIndexing directive. AddIconByEncoding : Associates icon with files whose MIME icon mimeencoding encoding is mimeencoding; used with the FancyIndexing directive AddIconByType Sets icon as the icon to display next to files icon mimetype with the MIME type of mimetype; used with the FancyIndexing directive

12 Created by : Ashish Shah, J.M. PATEL COLLEGE
Default server config. AddLanguage mimelang : name Maps the filename extension specified by name to the MIME language mimelang, overriding previous mappings for name. AddOutputFilter : Associates an output filter for server output of output mimetype type output with the MIME type mimetype AddType mimetype : name Adds the specified mimetype for files ending in name to the list of MIME types read from the TypeConfig file. Alias urlpath dirpath Maps the directory urlpath, specified relative to DocumentRoot, to the file system directory dirpath enabling Apache to access a directory otherwise inaccessible because all

13 Created by : Ashish Shah, J.M. PATEL COLLEGE
Default server config. DefaultType text/plain : Defines the default MIME type when a requested document’s MIME type cannot be determined using the TypesConfig or AddType directives : <Directory dirname> Delimits a set of configuration directives directives that apply to dirname and its subdirectories, </Directory> if any DirectoryIndex : filename Specifies one or more filenames that can serve as a directory index when a request does not specify a particular file or document DocumentRoot : “/var Sets the base directory from which all /www/html” requested documents will be served; document URLs (filenames) are interpreted relative to DocumentRoot; see also UserDir ErrorLog logs/error _log : Defines the name of Apache’s error log, relative to ServerRoot if the filename does

14 Apache’s configuration-sec-3 Configuring Virtual Servers
Created by : Ashish Shah, J.M. PATEL COLLEGE Apache’s configuration-sec-3 Configuring Virtual Servers Virtual servers (also referred to as virtual hosts) are primarily used to run Web servers for multiple domains on a single physical system. Virtual servers can also be used to allow multiple workgroups or departments that share the same network or subnet to maintain independent Web pages without requiring individual dedicated departmental servers. Virtual hosts fall into two categories: IP-based virtual hosts and name-based virtual hosts.

15 IP-based virtual hosts and name-based virtual hosts
Created by : Ashish Shah, J.M. PATEL COLLEGE IP-based virtual hosts and name-based virtual hosts IP-based virtual hosts refer to Web servers that have different IP addresses. In some cases, the different IP addresses correspond to different Ethernet interfaces, such as eth0 and eth1 (machines that have multiple Ethernet interfaces are called multi homed hosts). In other cases, a single Ethernet interface is assigned multiple IP addresses using aliases.

16 Virtual Server Configuration Directives
Created by : Ashish Shah, J.M. PATEL COLLEGE Virtual Server Configuration Directives <VirtualHost ipaddr[:port] : Defines a virtual host whose IP address is directives addr (listening on port, if specified); </VirtualHost> directives are one or more of the directives listed previously and override the directives listed for the default server. NameVirtualHost ipaddr[:port] Defines the IP address addr (listening on port, if specified) for a name-based virtual host. ServerAlias altname Enables the virtual server to respond to one or more alternate hostnames altname when used with name-based virtual hosts. A single VirtualHost directive can have multiple ServerAlias statements. ServerName fqdn : Sets the name of the virtual server to the FQDN fqdn.

17 Created by : Ashish Shah, J.M. PATEL COLLEGE
A bare-bones set of name-based virtual server definitions might resemble the following: Listen 80 [...] NameVirtualHost *:80 <VirtualHost *:80> ServerName webbeast.example.com DocumentRoot /var/www/webbeast # other directives </VirtualHost> ServerName DocumentRoot /var/www/mydomain ServerName DocumentRoot /var/www/yourdomain

18 Starting and Stopping Apache
Created by : Ashish Shah, J.M. PATEL COLLEGE Starting and Stopping Apache To start and stop Apache, the preferred method is to use the httpd initialization script and the service utility, as shown in the following examples: # service httpd start Starting httpd: [ OK ] # service httpd stop Stopping httpd: [ OK ]

19 Starting and Stopping Apache
Created by : Ashish Shah, J.M. PATEL COLLEGE Starting and Stopping Apache The first command stops and restarts the server. The second one sends Apache the SIGHUP signal, which causes it to reread httpd.conf. The effect is the same regardless of which command you use. However, you need to tell Apache which directories contain content it should parse for SSI content.

20 Created by : Ashish Shah, J.M. PATEL COLLEGE
<Directory “/var/www/html/tests”> Options Indexes FollowSymLinks Includes AllowOverride None Order allow,deny Allow from all </Directory>

21 Created by : Ashish Shah, J.M. PATEL COLLEGE
The Options Includes directive instructs Apache to parse files it serves from this directory for SSI directives. Next, create the Web page shown in Listing, naming it ssitest.shtml and placing it in /var/www/html/tests:

22 An SSI test page. ssitest.shtml file :
Created by : Ashish Shah, J.M. PATEL COLLEGE An SSI test page. ssitest.shtml file :

23 Viewing ssitest.html in Firefox.
Created by : Ashish Shah, J.M. PATEL COLLEGE Viewing ssitest.html in Firefox.


Download ppt "Unit-5 Chap-1 Configuring Web Server"

Similar presentations


Ads by Google