0% found this document useful (0 votes)
13 views23 pages

Virtual Hosting Overview and Configurations

Uploaded by

Douglas Kamga
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views23 pages

Virtual Hosting Overview and Configurations

Uploaded by

Douglas Kamga
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Virtual Hosting

• Hosting more than one website on a single server is called as Virtual


Hosting.

• Types of virtual hosting:

– Name based virtual hosting

– IP based virtual hosting

– Port based virtual hosting

Name Based Virtual Hosting

DNS Server

[Link]
Web Server

[Link]

[Link]

[Link]
Ravi
Linux Client
[Link]
Web Browsing – Named Based Virtual Hosting

[Link]

Web Browsing – Named Based Virtual Hosting

webserver [Link]
DNS Server
Forward zone [Link] www [Link]
[Link] dns [Link]
Web Server
webserver [Link]
Forward zone [Link] www [Link] [Link]
dns [Link]

[Link]

[Link]
Ravi
Linux Client
[Link]

Web Browsing – Named Based Virtual Hosting


Web Browsing – Named Based Virtual Hosting

[Link]

Web Browsing – Named Based Virtual Hosting

webserver [Link]
DNS Server
Forward zone [Link] www [Link]
[Link] dns [Link]
Web Server
webserver [Link]
Forward zone [Link] www [Link] [Link]
dns [Link]

[Link]

[Link]
Ravi
Linux Client
[Link]

Web Browsing – Named Based Virtual Hosting


IP Based Virtual Hosting

DNS Server

[Link]
Web Server

[Link]

[Link]

[Link]

[Link]
Ravi
Linux Client
[Link]

Web Browsing – IP Based Virtual Hosting

[Link]

Web Browsing – IP Based Virtual Hosting

webserver [Link]
DNS Server
Forward zone [Link] www [Link]
[Link] dns [Link]
Web Server
webserver [Link]
Forward zone [Link] www [Link]
dns [Link]

[Link]

[Link]

[Link]

[Link]
Ravi
Linux Client
[Link]
Web Browsing – IP Based Virtual Hosting

Web Browsing – IP Based Virtual Hosting

[Link]

Web Browsing – IP Based Virtual Hosting

webserver [Link]
DNS Server
Forward zone [Link] www [Link]
[Link] dns [Link]
Web Server
webserver [Link]
Forward zone [Link] www [Link]
dns [Link]

[Link]

[Link]

[Link]

[Link]
Ravi
Linux Client
[Link]
Web Browsing – IP Based Virtual Hosting

Port Based Virtual Hosting

DNS Server

[Link]

Web Server

[Link]

[Link]:5000
Ravi
Linux Client
[Link]

Web Browsing – Port Based Virtual Hosting

[Link]
Web Browsing – Port Based Virtual Hosting

webserver [Link]
DNS Server
Forward zone [Link] www [Link]
[Link] dns [Link]

Web Server

[Link]

[Link]:5000
Ravi
Linux Client
[Link]

Web Browsing – Port Based Virtual Hosting

Web Browsing – Port Based Virtual Hosting

[Link]
Web Browsing – Port Based Virtual Hosting

webserver [Link]
DNS Server
Forward zone [Link] www [Link]
[Link] dns [Link]

Web Server

[Link]

[Link]:5000
Ravi
Linux Client
[Link]

Web Browsing – Port Based Virtual Hosting

Apache Web Server

• Packages
– httpd*.rpm
• Port Numbers

– 80 Hyper Text Transfer Protocol (HTTP)

• Configuration File

– /etc/httpd/conf/[Link]

• Service / Daemon

– httpd
Name Based Virtual Hosting

DNS Server

[Link]
Web Server

[Link]

[Link]

[Link]
Ravi
Linux Client
[Link]

Apache Web Server Configuration

Install the Apache packages


[root@webserver ~]# yum install httpd*

Name Based Virtual Hosting Configuration

Edit the configuration file


[root@webserver ~]# vi /etc/httpd/conf/[Link]

Add the below lines at the end of the file


NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin root@[Link]
DocumentRoot /var/www/html
ServerName [Link]
DirectoryIndex [Link]
</VirtualHost>
Name Based Virtual Hosting Configuration

<VirtualHost *:80>
ServerAdmin root@[Link]
DocumentRoot /var/www/html
ServerName [Link]
DirectoryIndex [Link]
</VirtualHost>

Name Based Virtual Hosting Configuration

Restart the web service


[root@webserver ~]# service httpd restart

Linux Client Configuration

Configure primary DNS server address


[root@client1 ~]# vi /etc/[Link]

Add the DNS server IP address

nameserver [Link]
Linux Client Configuration

To access the website


Open a browser (Mozilla, Fire Fox, etc).
In the URL address box type
[Link] or [Link]

DNS Server Configuration

Install the DNS packages


[root@dns ~]# yum install bind* caching*

DNS Server Configuration

Edit the configuration file


[root@dns ~]# vi /etc/[Link]

Change the below options

listen-on port 53 { [Link]; [Link]; };


allow-query { localhost; [Link]/24; };
match-clients { localhost; [Link]/24; };
DNS Server Configuration

Edit the configuration file


[root@dns ~]# vi /etc/[Link]

Add the lines at the bottom of the file


zone "[Link]" IN {
type master;
file “[Link]";
};
zone “[Link]" IN {
type master;
file “[Link]";
};

DNS Server Configuration

Copy with permissions the forward lookup zone file for editing
[root@dns ~]# cd /var/named/chroot/var/named
[root@dns named]# cp -p [Link] [Link]

DNS Server Configuration

Edit the configuration file


[root@dns named]# vi [Link]

Make the following entries


$TTL 86400
@ IN SOA [Link]. [Link].(
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
IN NS [Link].
dns IN A [Link]
webserver IN A [Link]
www IN CNAME webserver
DNS Server Configuration

Copy with permissions the forward lookup zone file for editing
[root@dns ~]# cd /var/named/chroot/var/named
[root@dns named]# cp -p [Link] [Link]

DNS Server Configuration

Edit the configuration file


[root@dns named]# vi [Link]

Make the following entries


$TTL 86400
@ IN SOA [Link]. [Link].(
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
IN NS [Link].
dns IN A [Link]
webserver IN A [Link]
www IN CNAME webserver

DNS Server Configuration

Restart the DNS service


[root@dns ~]# service named restart

To check the resolution

[root@dns ~]# dig [Link]


[root@dns ~]# dig [Link]
IP Based Virtual Hosting

DNS Server

[Link]
Web Server

[Link]

[Link]

[Link]

[Link]
Ravi
Linux Client
[Link]

Assign Virtual IP Address

Assigning virtual IP address


[root@webserver ~]# netconfig --device eth0:1
[root@webserver ~]# service network restart

IP Based Virtual Hosting Configuration

Edit the configuration file


[root@server ~]# vi /etc/httpd/conf/[Link]

Change the below options


NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin root@[Link]
DocumentRoot /var/www/html
ServerName [Link]
DirectoryIndex [Link]
</VirtualHost>
IP Based Virtual Hosting Configuration

<VirtualHost [Link]:80>
ServerAdmin root@[Link]
DocumentRoot /var/www/html
ServerName [Link]
DirectoryIndex [Link]
</VirtualHost>

IP Based Virtual Hosting Configuration

Restart the web service


[root@webserver ~]# service httpd restart

Linux Client Configuration

To access the website


Open a browser (Mozilla, Fire Fox, etc).
In the URL address box type
[Link] or [Link]
[Link] or [Link]
DNS Server Configuration

Edit the configuration file


[root@dns ~]# vi /etc/[Link]
Add the lines at the bottom of the file
zone "[Link]" IN {
type master;
file “[Link]";
};
zone “[Link]" IN {
type master;
file “[Link]";
};

DNS Server Configuration

Copy with permissions the forward lookup zone file for editing
[root@dns ~]# cd /var/named/chroot/var/named
[root@dns named]# cp -p [Link] [Link]

DNS Server Configuration

Edit the configuration file


[root@dns named]# vi [Link]

Make the following entries


$TTL 86400
@ IN SOA [Link]. [Link].(
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
IN NS [Link].
dns IN A [Link]
webserver IN A [Link]
www IN CNAME webserver
DNS Server Configuration

Restart the DNS service


[root@dns ~]# service named restart

To check the resolution

[root@dns ~]# dig [Link]


[root@dns ~]# dig [Link]

Port Based Virtual Hosting

DNS Server

[Link]

Web Server

[Link]

[Link]:5000
Ravi
Linux Client
[Link]

Port Based Virtual Hosting Configuration

Edit the configuration file


[root@webserver ~]# vi /etc/httpd/conf/[Link]

Change the below options


NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin root@[Link]
DocumentRoot /var/www/html
ServerName [Link]
DirectoryIndex [Link]
</VirtualHost>
Port Based Virtual Hosting Configuration

LISTEN 5000
<VirtualHost [Link]:5000>
ServerAdmin root@[Link]
DocumentRoot /var/www/html
ServerName [Link]
DirectoryIndex [Link]
</VirtualHost>

Port Based Virtual Hosting Configuration

Restart the web service


[root@webserver ~]# service httpd restart

Linux Client Configuration

To access the website


Open a browser (Mozilla, Fire Fox, etc).
In the URL address box type
[Link] or [Link]
[Link] or [Link]
Proxy Server

• Proxy servers are used to share an Internet connection with many


clients.

• A proxy server can be configured as :-

– A simple proxy server -- to share the Internet connection.

– A caching web server -- to store web pages locally to improve


performance.

– A firewall -- to control access to the Internet.

• Squid Proxy is the most widely used open source proxy.

How Proxy Works?

Proxy Server

[Link]

[Link]

[Link]

[Link]

Linux Client Windows Client

[Link] [Link]
How Proxy Works?

[Link]

How Proxy Works?

Proxy Server

[Link]
Web pages cached
[Link]

[Link]

[Link]

Linux Client Windows Client

[Link] [Link]

How Proxy Works?


Squid Proxy Server

• Packages
– squid*.rpm
• Port Numbers

– 3128 (default)

• Configuration File

– /etc/squid/[Link]

• Service / Daemon

– squid

Squid Proxy Server Configuration

Proxy Server

[Link]

[Link]

[Link]

[Link]

Linux Client Windows Client

[Link] [Link]

Squid Proxy Server Configuration

Install the Squid proxy packages


[root@proxyserver ~]# yum install squid*
Squid Proxy Server Configuration

Edit the configuration file


[root@proxyserver ~]# vi /etc/squid/[Link]

Modify the following parameters


http_port 3128
visible_hostname linux-squid
cache_dir ufs /var/spool/squid 100 16 256
acl our_networks src [Link]/24
acl business_hours time S M T W H F A 09:00-17:30
acl test url_regex [Link]
http_access allow our_networks business_hours test

Squid Proxy Server Configuration

Restart the squid service


[root@proxyserver ~]# service squid restart

Linux Client Configuration

Linux client configuration – text mode


[root@client1 ~]# elinks

In elinks window
Click on Setup and select Options Manager.
In Protocols, select Http.
Select the Proxy Configuration option.
In Host and port number, select Edit.
Type the <proxy server IP address and the port number>
Then select Save and OK.
Close
Linux Client Configuration

To browse using Firefox


Open Firefox
Go to Edit menu and Select Preferences.
In the General, click on Connection Settings.
Select the Manual Proxy Configuration option.
In the Http Proxy box, type the proxy server IP address
[Link]
In the Http proxy Port box, type the Proxy Port Number 3128

You might also like