apache server by innovationframes.com » [email protected]

51
APACHE SERVER • By Innovationframes.com » [email protected]

Upload: julie-reynolds

Post on 23-Dec-2015

214 views

Category:

Documents


0 download

TRANSCRIPT

APACHE SERVER

• By Innovationframes.com

» [email protected]

Apache Web Server• Apache web server:

• The Apache Web server is a free HTTP (Web) server developed by the Apache Server Project.

• It is a reliable, efficient , and easily extensible Web Server

• Free open source code

Important directories and configuration files

Apache Web Server

Service profile

• Packages - httpd

• Configurations file - /etc/httpd/conf/httpd.conf

• Daemons - httpd

• Portnumber - 80

Query a httpd package whether installed or not but the screen shows httpd packages is not

installed.

Web server configuration

Web server configuration

httpd package is installed using rpm

command.

Now query the package it show package is

installed.

Open the httpd configuration file.

Web server configuration

You can see the first page file content, we need to edit the end part of the, so press shift+G in command mode the cursor will

bottom of page.

Web server configuration

This screen show end of httpd.conf file.

Web server configuration

Copy the last seven lines .

Paste the copied lines here .

Web server configuration

In virtual host field we enter ipaddress or fully qualified

domain address.

Web server configuration

Here specify the e-mail address of the administrator for the web

server.

Here specify the base directory from which html files will be

saved..

Here specify the hostname for your server.

Now save and quit the the httpd.conf file.

After editing the configuration file The service httpd is

restarted.

Web server configuration

Creating index.html page and place this file in the /var/www/html/

directory.

Web server configuration

Let us create html file .

Web server configuration

After typing save and quit the file.

Open the mozilla web browser and type the fully qualified domain name in address bar and press

enter, it will open corresponding web page.

Web server configuration

To allow only a particular user to access our web site we can add directory session inside

virtualhost session.

Web server configuration

Setting up /var/www/html/ access control directive .

Directives that can be overridden by the entries in

an .htaccess file.

Create .htaccess file in /var/www/html/ directory

and open the file .

Web server configuration

The authorization realm is given to the client so the user knows

which username and password to send.

Web server configuration

Type of user authentication for directory. only Basic and Digest

are currently implemented.

This file contain list of users and passwords for user

authentication.

Selects the authenticated users that can access a directory.

Web server configuration

Set the httpd password for the user joe .

httpd password is stored in htpasswd file.

Web server configuration

Set full permission for the htpasswd file to make sure that

the user has the execute permission .

Web server configuration

To add another user in the htpasswd file.

Web server configuration

Restart the httpd service.

Web server configuration

Web server configuration

Enter the fully qualified domain name in address bar.

When we access the web page the mozilla will prompts for the

username and password.

Web server configuration

Web server configuration

Enter the username and the password.

Web server configuration

Now you can see the web page.

Access Control• The web access can be controlled by using

access control directives such as allow and deny.

Directive Description

deny from host host ….

Determines hosts that can access a given directory: all, or partial or full domain name or ip address.

allow from host host ….

Determines which hosts can access a given directory: all, or partial or full domain name or ip address.

This indicates that we can access the web page from any

network.

Web server configuration

To access the web page only from the above specified

network.

Web server configuration

Virtual host

• Virtual hosts allow you to host multiple domains from a single machine.

• Apache supports two different type of virtual hosts.

• • Name-based virtual hosts

• Ip-based virtual hosts •

Ip and Named-based Virtual Hosts

• IP-based virtual hosts• -Ip-based virtual hosts are used when

a single machine has several different IP address.

• -To run a virtual host on each IP address.

• Named-based virtual hosts

• -It allow you to host many virtual hosts from a single IP address.

Name-based virtual hosts

Here we place two domains in a single ip address and we can place number of domains

using single IP address.

Two domains are used in the name of example and test.com in a single ip address 192.168.0.20.

An ip address is mentioned in the virtualhost field.

Name-based virtual hosts

The server fully qualified domain name is described

here.

Name-based virtual hosts

A Directory is created in the specified path as above here

copy test.com webpage..

Name-based virtual hosts

Httpd service is restarted.

Name-based virtual hosts

This is the webpage for the test.com .

Name-based virtual hosts

This is the webpage for example.com.

Name-based virtual hosts

Now you can access the web page securely.

Apache Encrypted Web Server

• Apache can provide encrypted

communications using the mod_ssl apache

module.

• To make use of encrypted communications,

a client must request the https protocol.

• Encryption is based on either the RSA or

DSA algorithm.

Apache Encrypted Web Server

• Package - mod_ssl

• Port number - 443

• Certificate - conf/ssl.crt/server.crt

• Private key - conf/ssl.key/server.key

• Self-signed cert - make testcert

• Certificate signature req - make certreq

Apache Encrypted Web Server

Query is made to check whether the mod_ssl

package is installed. if not, install the packages

Apache Encrypted Web Server

To generate the certificate signature request.

Apache Encrypted Web Server

The self signed certificate can be installed using the command

make testcert.

Apache Encrypted Web Server

When we restart the httpd service it will prompts for the

password.

Apache Encrypted Web Server

Open the mozilla browser and type fully qualified name in the address bar using https protocol.

Apache Encrypted Web Server

Click here to view the

certificate.

Apache Encrypted Web Server

Here you can view the certificate informations.

Apache Encrypted Web Server

After examining accept the certificate temporarily or permanent

and then click ok.

Apache Encrypted Web Server

You can see a warning message indicating that this page can not

be read by a third party.

Apache Encrypted Web Server