Web. Computer Center, CS, NCTU 2 Outline  Web hosting Basics Client-Server architecture HTTP protocol Static vs. dynamic pages Virtual hosts  Proxy.

Slides:



Advertisements
Similar presentations
TCP/IP Protocol Suite 1 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 22 World Wide Web and HTTP.
Advertisements

PART 6 Application Layer
Kyung Hee University 1 1 Application Layer. 2 Kyung Hee University Position of Application Layer.
HTTP HyperText Transfer Protocol. HTTP Uses TCP as its underlying transport protocol Uses port 80 Stateless protocol (i.e. HTTP Server maintains no information.
HTTP – HyperText Transfer Protocol
Chapter 22 Web Hosting. Computer Center, CS, NCTU 2 Web Hosting – Basics (1)  Three major techniques in WWW (World Wide Web) System HTML HTTP URL  HTML.
2440: 141 Web Site Administration Web Application Resources Instructor: Enoch E. Damson.
Web Proxy. Computer Center, CS, NCTU 2 Proxy  Proxy A proxy server is a server which services the requests of its clients by:  Making requests to other.
The Web The World Wide Web What does it do?.
How the web works: HTTP and CGI explained
HTTP Presented By: Holly Mortinson Amy Drout Kyle Balmer & Matt Conklin.
Chapter 22 Web Hosting and Internet Servers. Computer Center, CS, NCTU 2 Web Hosting Basics (1)  Three major techniques in WWW (World Wide Web) System.
The World Wide Web and the Internet Dr Jim Briggs 1WUCM1.
IST 221 Internet Concepts and Applications Internet, WWW and HTML 1.
1 The HyperText Transfer Protocol: HTTP Nick Smith Stuart Alley Tara Tjaden.
Definitions, Definitions, Definitions Lead to Understanding.
World Wide Web WeeSan Lee
Hypertext Transport Protocol CS Dick Steflik.
 What is it ? What is it ?  URI,URN,URL URI,URN,URL  HTTP – methods HTTP – methods  HTTP Request Packets HTTP Request Packets  HTTP Request Headers.
Linux Operations and Administration
Appendix: Installing AMP (Apache + MySQL + PHP). Training Course, CS, NCTU 2 AMP  AMP A – Apache Web Server M – MySQL Database Server P – PHP Language.
CSCI 323 – Web Development Chapter 1 - Setting the Scene We’re going to move through the first few chapters pretty quick since they are a review for most.
INTRODUCTION TO WEB DATABASE PROGRAMMING
Human-Computer Interface Course 5. ISPs and Internet connection.
Web Architecture Dr. Frank McCown Intro to Web Science Harding University This work is licensed under a Creative Commons Attribution-NonCommercial- ShareAlike.
Copyright © cs-tutorial.com. Introduction to Web Development In 1990 and 1991,Tim Berners-Lee created the World Wide Web at the European Laboratory for.
Chapter 33 CGI Technology for Dynamic Web Documents There are two alternative forms of retrieving web documents. Instead of retrieving static HTML documents,
DATA COMMUNICATION DONE BY: ALVIN SAMPATH CARLVIN SAMPATH.
FTP (File Transfer Protocol) & Telnet
27.1 Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
CP476 Internet Computing Lecture 5 : HTTP, WWW and URL 1 Lecture 5. WWW, HTTP and URL Objective: to review the concepts of WWW to understand how HTTP works.
TCP/IP Protocol Suite 1 Chapter 22 Upon completion you will be able to: World Wide Web: HTTP Understand the components of a browser and a server Understand.
Application Layer 2 Figures from Kurose and Ross
Rensselaer Polytechnic Institute Shivkumar Kalvanaraman, Biplab Sikdar 1 The Web: the http protocol http: hypertext transfer protocol Web’s application.
Maryam Elahi University of Calgary – CPSC 441.  HTTP stands for Hypertext Transfer Protocol.  Used to deliver virtually all files and other data (collectively.
Chapter 6 The World Wide Web. Web Pages Each page is an interactive multimedia publication It can include: text, graphics, music and videos Pages are.
Copyright (c) 2010, Dr. Kuanchin Chen1 The Client-Server Architecture of the WWW Dr. Kuanchin Chen.
Internet, intranet, and multimedia database processing l Database processing across local and wide area networks l Alternative architectures for distributing.
 Three major techniques in WWW (World Wide Web) System › HTML › HTTP › URL  HTML (1) – H yper T ext M arkup L anguage › Providing a means to describe.
20-753: Fundamentals of Web Programming Copyright © 1999, Carnegie Mellon. All Rights Reserved. 1 Lecture 7: HTTP and CGI Fundamentals of Web Programming.
1 Welcome to CSC 301 Web Programming Charles Frank.
INTRODUCTION TO WEB APPLICATION Chapter 1. In this chapter, you will learn about:  The evolution of the Internet  The beginning of the World Wide Web,
Form Data Encoding GET – URL encoded POST – URL encoded
 Proxy › A proxy server is a server which services the requests of its clients by:  Making requests to other servers  Caching some results for further.
Appendix E: Overview of HTTP ©SoftMoore ConsultingSlide 1.
1 WWW. 2 World Wide Web Major application protocol used on the Internet Simple interface Two concepts –Point –Click.
Operating Systems Lesson 12. HTTP vs HTML HTML: hypertext markup language ◦ Definitions of tags that are added to Web documents to control their appearance.
IS-907 Java EE World Wide Web - Overview. World Wide Web - History Tim Berners-Lee, CERN, 1990 Enable researchers to share information: Remote Access.
CITA 310 Section 2 HTTP (Selected Topics from Textbook Chapter 6)
27.1 Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
27.1 Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Internet Applications (Cont’d) Basic Internet Applications – World Wide Web (WWW) Browser Architecture Static Documents Dynamic Documents Active Documents.
Web, FTP, and Proxy.
Data Communications and Computer Networks Chapter 2 CS 3830 Lecture 7 Omar Meqdadi Department of Computer Science and Software Engineering University of.
1 Chapter 22 World Wide Web (HTTP) Chapter 22 World Wide Web (HTTP) Mi-Jung Choi Dept. of Computer Science and Engineering
INTRODUCTION Dr Mohd Soperi Mohd Zahid Semester /16.
TCP/IP Protocol Suite 1 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 22 World Wide Web and HTTP.
1 Chapter 1 INTRODUCTION TO WEB. 2 Objectives In this chapter, you will: Become familiar with the architecture of the World Wide Web Learn about communication.
Web.
Distributed Control and Measurement via the Internet
Web.
WWW and HTTP King Fahd University of Petroleum & Minerals
Web Development Web Servers.
Chapter 22 Web Hosting and Internet Servers
Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Web hwlin1414.
Chapter 27 WWW and HTTP.
PART 6 Application Layer
The HTTP Protocol COSC 2206 Internet Tools The HTTP Protocol
Presentation transcript:

Web

Computer Center, CS, NCTU 2 Outline  Web hosting Basics Client-Server architecture HTTP protocol Static vs. dynamic pages Virtual hosts  Proxy Forward proxy Reverse proxy squid

Computer Center, CS, NCTU 3 Web Hosting – Basics (1)  Three major techniques in WWW (World Wide Web) System HTML HTTP URL  HTML (1) – HyperText Markup Language Providing a means to describe the structure of text-based information in a document. The original HTML is created by Tim Berners-Lee. Published in 1993 by the IETF as a formal "application" of SGML (with an SGML Document Type Definition defining the grammar). The HTML specifications have been maintained by the World Wide Web Consortium (W3C). 

Computer Center, CS, NCTU 4 Web Hosting – Basics (2)  HTML (2) Mark-up the text and define presentation effect by HTML Tags. Hello World! Hello Wrold!

Computer Center, CS, NCTU 5 Web Hosting – Basics (3)  HTML 5 Introduction WebGL  3D demo 3D demo  3D Game demo:Quake 2 3D Game demo:Quake 2

Computer Center, CS, NCTU 6 Web Hosting – Basics (4)  HTTP – Hyper-Text Transfer Protocol A TCP-based protocol Communication method between client and server. All browsers and web servers have to follow this standard. Originally designed to transmit HTML pages. Now it is used to format, transmit, and link documents of variety media types  Text, picture, sound, animation, video, … HTTPS – secured version.

Computer Center, CS, NCTU 7 Web Hosting – Basics (5)  URL – Uniform Resource Locator Describe how to access an object shared on the Internet (RFC 1738) Format  Protocol :// [ [ username [ :password ] hostname [ :port ] ] [ /directory ] [ /filename ] ex:   ftp://ftp.cs.nctu.edu.tw/  telnet://bs2.to/

Computer Center, CS, NCTU 8 Web Hosting – Basics (6)  URL Protocols ProtoWhat it doesExample httpAccesses a remote file via HTTP httpsAccesses a remote file via HTTP/SSL ftpAccesses a remote file via FTP ftp://ftp.cs.nctu.edu.tw/ fileAccess a local file file:///home/lwhsu/.tcshrc mailtoSends mail newsAccesses Usenet newsgroups news:tw.bbs.comp.386bsd

Computer Center, CS, NCTU 9 Web Hosting – Client-Server Architecture (1)  Client-server architecture Web Server: Answer HTTP request Web Client: Request certain page using URL Client Browser Web Server 2. HTTP Request 4. HTTP Response 1. Send the request to server which URL point to 3. Respond the HTML resource pointed by URL 5. Show the data which HTML resource describes.

Computer Center, CS, NCTU 10 Web Hosting – Client-Server Architecture (2)  Using “ telnet ” to retrieve data from web server ~/public_html $ telnet 80 Trying Connected to Escape character is '^]'. GET /~liuyh/sa.html HTTP/1.0 HTTP/ OK Server: nginx/ Date: Sat, 12 Dec :14:45 GMT Content-Type: text/html Connection: close Last-Modified: Sat, 12 Dec :14:09 GMT Accept-Ranges: bytes Content-Length: 201 Vary: Accept-Encoding Hello World! Hello Wrold!

Computer Center, CS, NCTU 11 Web Hosting – The HTTP Protocol (1)  HTTP: Hypertext Transfer Protocol RFCs: (HTTP 1.1) (Updated Version) Useful Reference: A network protocol used to deliver virtually all files and other data on the World Wide Web.  HTML files, image files, query results, or anything else. Client-Server Architecture  A browser is an HTTP client because it sends requests to an HTTP server (Web server), which then sends responses back to the client.

Computer Center, CS, NCTU 12 Web Hosting – The HTTP Protocol (2) Clients: ※ Send Requests to Servers  Action “path or URL” Protocal –Actions: GET, POST, HEAD –Ex. GET /index.php HTTP/1.1  Headers –Header_Name: value –Ex. Host:  (blank line)  Data … Servers: ※ Respond to the clinets  Status: –200: OK –403: Forbidden –404: Not Found –426: Upgrade Required –… –Ex. HTTP/ OK  Headers –Same as clients –Ex. Content-Type: text/html  (blank line)  Data…

Computer Center, CS, NCTU 13 Web Hosting – The HTTP Protocol (3) ~/public_html $ telnet 80 Trying Connected to Escape character is '^]'. GET /~liuyh/sa.html HTTP/1.0 HTTP/ OK Server: nginx/ Date: Sat, 12 Dec :14:45 GMT Content-Type: text/html Connection: close Last-Modified: Sat, 12 Dec :14:09 GMT Accept-Ranges: bytes Content-Length: 201 Vary: Accept-Encoding Hello World! Hello Wrold! status Headers Data action Headers

Computer Center, CS, NCTU 14 Web Hosting – The HTTP Protocol (4)  Get vs. Post (client side) Get:  Parameters in URL GET /get.php?a=1&b=3 HTTP/1.1  No data content  Corresponding in HTML files –Link URL: –Using Form: … Post:  Parameters in Data Content POST /post.php HTTP/1.1  Corresponding in HTML files –Using Form: …

Computer Center, CS, NCTU 15 Web Hosting – The HTTP Protocol (5)  HTTP Headers: What HTTP Headers can do? [Ref]  Content information (type, date, size, encoding, …)  Cache control  Authentication  URL Redirection  Transmitting cookies  Knowing where client come from  Knowing what software client use  …

Computer Center, CS, NCTU 16 Web Hosting – Static vs. Dynamic Pages (1)  Static vs. Dynamic Pages Technologies of Dynamic Web Pages  Client Script Language –JavaScript, Jscript, VBScript  Client Interactive Technology –Java Applet, Flash, XMLHTTP,AJAX  Server Side –CGI –Languages: Perl, ASP, JSP, PHP, C/C++, …etc. Static vs. Dynamic

Computer Center, CS, NCTU 17 Web Hosting – Static vs. Dynamic Pages (2)  CGI (Common Gateway Interface) A specification that allows an HTTP server to exchange information with other programs

Computer Center, CS, NCTU 18 Web Hosting – Virtual Hosting (1)  Providing services for more than one domain-name (or IP) in one web server.  IP-Based Virtual Hosting vs. Name-Based Virtual Hosting IP-Base– Several IPs (or ports) Name-Base– Singe IP, several hostnames  Example (Apache configuration) DocumentRoot /www/sabsd ServerName sabsd.cs.nctu.edu.tw DocumentRoot /www/tphp ServerName tphp.cs.nctu.edu.tw NameVirtualHost ServerName nabsd.cs.nctu.edu.tw DocumentRoot "/www/na" ServerName sabsd.cs.nctu.edu.tw DocumentRoot "/www/sa"

Computer Center, CS, NCTU 19 Web Hosting – Virtual Hosting (2) Q: How Name-Based Virtual Hosting works? A: It takes use of HTTP Headers. $ telnet 80 Trying Connected to Escape character is '^]'. GET / HTTP/1.0 Host: HTTP/ Moved Permanently Server: nginx/ Date: Sat, 12 Dec :50:22 GMT Content-Type: text/html Connection: close Cache-Control: no-cache, must-revalidate Location: cht/announcements/index.php Vary: Accept-Encoding Connection closed by foreign host. $ telnet 80 Trying Connected to Escape character is '^]'. GET / HTTP/1.0 Host: HTTP/ OK Server: nginx/ Date: Sat, 12 Dec :51:43 GMT Content-Type: text/html Connection: close Vary: Accept-Encoding 國立交通大學資訊學院...

Computer Center, CS, NCTU 20 Proxy  Proxy A proxy server is a server which services the requests of its clients by:  Making requests to other servers  Caching some results for further same requests Goals:  Performance  Stability  Central Control  …etc. Roles:  Forward Proxy  Reverse Proxy Targets  Web pages/FTP files  TCP/IP Connections  …etc. Request Reply Request Reply (using cached result) Request Reply client Proxy Server Original Server

Computer Center, CS, NCTU 21 Proxy – The Forward Proxy  Forward Proxy Proxy the outgoing requests, for the reason of  Bandwidth saving  Performance  Central control When objects requested are  In cache, return the cached objects  Otherwise, proxy server requests object from origin server, then cache it and return to client Request Reply Request Reply (using cached result) Request Reply client Proxy Server Original Server

Computer Center, CS, NCTU 22 Proxy – The Reverse Proxy  Reverse Proxy Proxy the incoming requests, for the reason of  Reducing Server Load (by caching)  Load Balance  Fault Tolerant Reverse proxy acts as the original server, accept incoming requests, reply corresponding result. SEAMLESS for clients! Request Reply client Reverse Proxy Server Server1 Request Reply Server1 Internet

Computer Center, CS, NCTU 23 Proxy – SQUID  A web proxy server & cache daemon. Supports HTTP, FTP Limited support for TLS, SSL, Gopher, HTTPS  Port install: /usr/ports/www/squid{,30,31}  Startup: /etc/rc.conf  squid_enable="YES" /usr/local/etc/rc.d/squid start  Configuration Sample/Documents: /usr/local/etc/squid/squid.conf.default

Computer Center, CS, NCTU 24 Proxy – SQUID Configuration (1)  Listen Port Service Port  http_port 3128 Neighbored Communication  icp_port 3130  Logs access_log  access_log /var/log/squid/access.log squid cache_log  cache_log /var/log/squid/cache.log cache_store_log  cache_store_log /var/log/squid/store.log

Computer Center, CS, NCTU 25 Proxy – SQUID Configuration (2)  Access Control acl – define an access control list  Format: acl acl-name acl-type data acl all src / acl NCTU srcdomain.nctu.edu.tw acl YAHOO dstdomain.yahoo.com acl allowhost src “/usr/local/etc/squid.squid.allow” http_access – define the control rule  Format: http_access allow|deny acl-name http_access allow NCTU http_access allow allowhost http_access deny all

Computer Center, CS, NCTU 26 Proxy – SQUID Configuration (3)  Proxy Relationship Protocol: ICP (Internet Cache Protocol) RFC , using UDP Related Configuration  cache_peer hostname type http_port icp_port [options]  cache_peer_domain cache-host domain [domain …]  cache_peer_access cache-host allow|deny acl-name

Computer Center, CS, NCTU 27 Proxy – SQUID Configuration (4)  Cache Control cache_mem 256 MB cache_dir ufs /usr/local/squid/cache cache_swap_low 93 cache_swap_high 98 maximum_object_size 4096 KB maximum_object_size_in_memory 8 KB

Computer Center, CS, NCTU 28 Proxy – SQUID Configuration (5)  Sample: Proxy Configuration http_port 3128 icp_port 3130 cache_mem 32 MB cache_dir ufs /usr/local/squid/cache access_log /var/log/squid/access.log squid cache_log /var/log/squid/cache.log cache_store_log /var/log/squid/store.log pid_filename /usr/local/squid/logs/squid.pid visible_hostname nabsd.cs.nctu.edu.tw acl allowhosts src "/usr/local/etc/squid/squid.allow“ http_access allow allowhosts http_access deny all

Computer Center, CS, NCTU 29 Proxy – SQUID Configuration (6)  Sample: Reverse Proxy Configuration http_port 80 vhost icp_port 3130 cache_mem 32 MB cache_dir ufs /usr/local/squid/cache access_log /var/log/squid/access.log squid cache_log /var/log/squid/cache.log cache_store_log /var/log/squid/store.log pid_filename /usr/local/squid/logs/squid.pid visible_hostname nabsd.cs.nctu.edu.tw url_rewrite_program /usr/local/squid/bin/redirect.sh acl cswww dstdomain csws1 csws2 http_access allow all cswww always_direct allow cswww

Computer Center, CS, NCTU 30 Proxy – SQUID Configuration (7) % cat /usr/local/squid/bin/redirect.sh #!/bin/sh while read line do TIME=`date "+%S"` SERV=`expr $TIME % 2 + 1` echo $line | sed -e \ "s/^ done