Modul 3 Virtual Host

Published on April 2017 | Categories: Documents | Downloads: 13 | Comments: 0 | Views: 175
of 21
Download PDF   Embed   Report

Comments

Content


Virtual Host
(Web Server)
1
Muhammad Zen Samsono Hadi ST MSc Muhammad Zen Samsono Hadi, ST. MSc.
Lab. Komunikasi Digital
G d D Lt Gedung D4 Lt. 1
EEPIS-ITS
Virtual Networking implementation
2
Power consumption comparison
3
VS
5 Physical Virtual Server
servers
Power consumption comparison
230W
x
230W
x
5
x
24h
24h
24h
=
27.6kwh + a
=
5.5kwh + a
7
4
Virtual Server Advantages
 Power saving over multiple physical servers
5
g p p y
 Simplify system administration by integrating all
servers into one physical machine
 Server hardware resource optimization
Virtual Server disadvantages
 When host server machine crash, all virtual servers
6
,
embedded in the server crash too.
Virtual Hosting
 General term used when you run more than one
7
y
website on a single system.
 Allows ISPs and hosting providers to make money by
sharing resources among clients. Allows companies
and individuals to save time and money - a single
machine can host many websites machine can host many websites.
Virtual Host
8
Options for Hosting More than One Website on a
Single System Single System
 Run separate instances of httpd servers: httpd –f
9
/usr/local/apache/conf/httpd-virtual.conf
 Run a server that will listen on multiple ports and
ser e different content depending on the port serve different content depending on the port.
 True Virtual Hosting - Allows multiple IP address
and/or host names to be served through a single and/or host names to be served through a single
Apache server.
 IP-Based
 Name-Based
Virtual Hosting: IP Based
 You must configure your machine to “listen” for
10
 You must configure your machine to listen for
multiple IP addresses. One NIC binds to
multiple IP addresses p
 One hostname is associated with each IP
address
www.yahoo.com 216.32.74.52
SERVER
sports.yahoo.com
216.115.105.243
NIC
Virtual Hosting: Name Based
 A machine can host multiple websites using only 1 IP
11
p g y
address
 All hostnames have the same IP address
 Becoming more and more popular.
some.mydomain.com
SERVER
www.hisdomain.com
165.145.26.110
NIC
Setting-Up IP-Based Virtual Hosting: An
Overview Overview
12
 Once you have secured the domain
names/hostnames you want to use for your
b it d t i h f th website, you need to assign each of them a
unique IP address.
 Some ISPs can assign you additional IP Some ISPs can assign you additional IP
addresses.
 Blocks of IP addresses are usually assigned with
b l business T1s or DSL lines.
Setting-Up IP-Based Virtual Hosting, Con’t.
13
 You need to have DNS properly configured for
your domains, e.g. The world needs to know
that www.yourdomain.comis at the IP address
123.23.34.56.
b ll id  Remember, your ISP can usually provide DNS
service for your domains.
IP-Based Virtual Hosting: Setting Up Your
Machine Machine
 Your web server needs to be configured to listen
14
for the IP addresses related to your websites:
 UNIX-based OSs allow you to configure multiple
IP addresses sing the ifconfig command (m st be IP addresses using the ifconfig command (must be
run as root)
 Usage: ifconfig interface:<sub-number> IP Usage: ifconfig interface:<sub number> IP
 e.g: ifconfig eth0:0 165.230.30.71
 ifconfig eth0:1 165.230.30.72
 WinNT IP setup through Network control
panel.
Configuring Apache for IP-Based Virtual Hosting
 Configuring Apache for Virtual Hosting is quite
15
simple: Simply add a <VirtualHost> block within
the httpd.conf file.
Format  Format:
<Vi r t ual Host I P- or - HOSTNAME: Por t >
#Any Val i d ht t pd. conf di r ect i ves # y p
</ Vi r t ual Host >
 Required for each Virtual Host website your are
using…therefore your httpd.conf can have multiple
<VirtualHost> blocks.
IP-Based VH Configuration con’t.
 Typical <VirtualHost> block in httpd.conf:
16
Typical <VirtualHost> block in httpd.conf:
<Vi r t ual Host www. bear snest . or g>
Document Root / home/ www/ bear snest / ht docs
Ser ver Admi n chr i sj ur @cj u. com
Ser ver Name www bear snest or g Ser ver Name www. bear snest . or g
Er r or Log l ogs/ bear s- er r or _l og
Tr ansf er Log l ogs/ bear s- access_l og
Redi r ect / adpr ot ech ht t p: / / www. adpr ot ech. com
/ / / / / / Al i as / st af f / home/ chr i sj ur / ht docs/ bn/ st af f
</ Vi r t ual Host >
 The key: Vitual hosts will have their own unique  The key: Vitual hosts will have their own unique
DocumentRoot – different content for different
sties.
Steps for Setting-Up Name-Based Virtual
Hosting Hosting
 When setting up Name-based virtual hosts, you
17
When setting up Name based virtual hosts, you
need to add the special NameVirtualHost Directive
to your httpd.conf:
 NameVi r t ual Host <Your I P Addr ess>
 Which tells Apache the single IP address you will
f ll b i use for all your websites.
 Now simply add <VirtualHost> blocks for each of
b it d i your website domains.
Name-Based VH Examples
NameVi r t al Host 165 230 30 68
18
NameVi r t ual Host 165. 230. 30. 68
<Vi r t ual Host www. your si t e. or g>
Document Root / home/ www/ your si t e/ ht docs
Ser ver Admi n [email protected] si t e. com Ser ver Admi n [email protected] si t e. com
Ser ver Name www. your si t e. com
Er r or Log l ogs/ your si t e- er r or _l og
</ Vi r t ual Host >
<Vi r t ual Host www. mysi t e. com>
Document Root / home/ www/ mysi t e/ ht docs
Ser ver Admi n [email protected] t e. com
Ser ver Name www. mysi t e. or g
Er r or Log l ogs/ mysi t e- er r or _l og
</ Vi r t ual Host >
Virtual Hosting Recap
 Get your DNS configured for each domain
19
y g
 IP-based Virtual Hosting vs. Name-based Virtual
Hosting
 Configure your server for multiple IP addresses if
using IP-based Virtual Hosting
 Create new directories for new Document Roots
 Add <VirtualHost> blocks to your httpd.conf y p
Delivering Dynamic Content
 Two ways of delivering dynamic content for the
20
y g y
Web: client-side or server-side technologies
 Client-Side
 Elements are downloaded to the browser and execute on
the client’s system.
E l J S i J A l li id i  Examples: JavaScript, Java Applets, client-side image
maps.
 Web server administrator needs to see that MIME types  Web server administrator needs to see that MIME types
are set correctly.
Dynamic Content, con’t.
Ser er Side
21
 Server-Side
 Server processes “on-the-fly” content that is passed
to client browser.
 Examples: server-side includes, CGI (Common
Gateway Interface), server-side image maps, ASP
(Active Server Pages), Java Servlets. PHP
S id h l i ll i  Server-side technologies generally require
additional configuration of the Web server in order
to function properly. Usually require specific
Apache modules Apache modules.
 Enabling server-side technologies generally has
security implications.

Sponsor Documents

Or use your account on DocShare.tips

Hide

Forgot your password?

Or register your new account on DocShare.tips

Hide

Lost your password? Please enter your email address. You will receive a link to create a new password.

Back to log-in

Close