Basics of the HTTP Protocol and Apache Web Server Brandon Checketts.

Slides:



Advertisements
Similar presentations
HTTP HyperText Transfer Protocol. HTTP Uses TCP as its underlying transport protocol Uses port 80 Stateless protocol (i.e. HTTP Server maintains no information.
Advertisements

Chapter 9 Application Layer, HTTP Professor Rick Han University of Colorado at Boulder
16-Jun-15 HTTP Hypertext Transfer Protocol. 2 HTTP messages HTTP is the language that web clients and web servers use to talk to each other HTTP is largely.
HTTP Hypertext Transfer Protocol. HTTP messages HTTP is the language that web clients and web servers use to talk to each other –HTTP is largely “under.
How the web works: HTTP and CGI explained
CSE 190: Internet Commerce Lecture 4: Web Servers.
TCP/IP Protocol Suite 1 Chapter 22 Upon completion you will be able to: World Wide Web: HTTP Know how HTTP accesses data on the WWW Objectives.
Web, HTTP and Web Caching
CP476 Internet Computing Browser and Web Server 1 Web Browsers A client software program that allows you to access and view Web pages on the Internet –Examples.
2/9/2004 Web and HTTP February 9, /9/2004 Assignments Due – Reading and Warmup Work on Message of the Day.
CSC 2720 Building Web Applications Servlet – Getting and Setting HTTP Headers.
Shibboleth Training: Round Two 1
Deploying Ruby on Rails How to make your application actually serve Dan Buettner 18 Oct 2007.
Web Servers Web server software is a product that works with the operating system The server computer can run more than one software product such as .
Web Hacking 1. Overview Why web HTTP Protocol HTTP Attacks 2.
1 HTTP Caching & Cache-Busting for Content Publishers Michael J. Radwin ApacheCon 2005 Wednesday, 14 December 2005.
HTTP Caching & Cache-Busting for Content Publishers Michael J. Radwin O’Reilly Open Source Convention July 28, 2004.
Java Technology and Applications
HTTP – HyperText Transfer Protocol
SUNY Polytechnic Institute CS 490 – Web Design, AJAX, jQuery Web Services A web service is a software system that supports interaction (requesting data,
HTTP Protocol Specification
HTTP HTML Introduction to web development. elaborate SPARCS 07 Wheel Moodle TA 안병욱 CS101 TA The presenter is 바퀴짱 ? 3 월 신작 ? 밤의 제왕 ? 악명 높은 TA?
FTP (File Transfer Protocol) & Telnet
CSC 2720 Building Web Applications Getting and Setting HTTP Headers (With PHP Examples)
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.
2: Application Layer1 CS 4244: Internet Software Development Dr. Eli Tilevich.
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.
© Janice Regan, CMPT 128, Jan 2007 CMPT 371 Data Communications and Networking HTTP 0.
System Administration NFS & Web Servers. NFS SERVER.
IT Engineering Instructor: Rezvan Shiravi
CSE 190: Internet E-Commerce Lecture 5. Exam Material Lectures 1-4 (Presentation Tier) –3-tier architecture –HTML –Style sheets –Javascript –DOM –HTTP.
Apache and... Virtual Hosts ---- aliases mod_rewrite ---- htaccess AFNOG 11 Kigali, Rwanda May 2010 Dorcas Muthoni Courtesy: Hervey Allen.
Proxy Lab Recitation I Monday Nov 20, 2006.
HyperText Transfer Protocol (HTTP) RICHI GUPTA CISC 856: TCP/IP and Upper Layer Protocols Fall 2007 Thanks to Dr. Amer, UDEL for some of the slides used.
HTTP1 Hypertext Transfer Protocol (HTTP) After this lecture, you should be able to:  Know how Web Browsers and Web Servers communicate via HTTP Protocol.
CIS679: Lecture 13 r Review of Last Lecture r More on HTTP.
A Little Bit About Cookies Fort Collins, CO Copyright © XTR Systems, LLC A Little Bit About Cookies Instructor: Joseph DiVerdi, Ph.D., M.B.A.
1-1 HTTP request message GET /somedir/page.html HTTP/1.1 Host: User-agent: Mozilla/4.0 Connection: close Accept-language:fr request.
1 Apache and... Virtual Hosts ---- aliases mod_rewrite ---- htaccess AFNOG X Cairo, Egypt May 2009 Hervey Allen.
Ruby on Rails on Ubuntu Bradley Taylor Rails Machine, LLC
LinuxChix Apache. Serving Webpages The layer 7 protocol (HTTP) is what our browsers talk to get us the websites we can't seem to live without. HTTP is.
Tutorial Shengdong Zhao (some slides are reused/modified from Neil Ernst’s apache tutorial)
Apache HTTP Server from 10,000 feet An open source Apache feature overview and discussion.
CITA 310 Section 2 HTTP (Selected Topics from Textbook Chapter 6)
ECMM6018 Enterprise Networking for Electronic Commerce Tutorial 7
CIT 383: Administrative ScriptingSlide #1 CIT 383: Administrative Scripting HTTP.
HTTP How the Internet servers and clients communicate.
JavaScript, Part 4 Instructor: Charles Moen CSCI/CINF 4230.
HTTP Here, we examine the hypertext transfer protocol (http) – originally introduced around 1990 but not standardized until 1997 (version 1.0) – protocol.
Summer 2007 Florida Atlantic University Department of Computer Science & Engineering COP 4814 – Web Services Dr. Roy Levow Part 1 – Introducing Ajax.
Web Server Administration Chapter 6 Configuring a Web Server.
CITA 310 Section 5 Virtual Hosts and Virtual Directories (Selected Topics from Textbook Chapter 6)
Overview of Servlets and JSP
LURP Details. LURP Lab Details  1.Given a GET … call a proxy CGI script in the same way you would for a normal CGI request  2.This UDP perl.
COMP2322 Lab 2 HTTP Steven Lee Jan. 29, HTTP Hypertext Transfer Protocol Web’s application layer protocol Client/server model – Client (browser):
Web Caching. Why Caching? Faster browsing experience for users Cache hit rate Traffic Prioritization Reduce network bandwidth requirements significantly.
The OWASP Foundation OWASP Education Computer based training The Basics Nishi Kumar IT Architect Specialist, FIS Chair, Software Security.
Week 11: Application Layer 1 Web and HTTP r Web page consists of objects r Object can be HTML file, JPEG image, Java applet, audio file,… r Web page consists.
© Janice Regan, CMPT 128, Jan 2007 CMPT 371 Data Communications and Networking HTTP 0.
Web Server Administration Chapter 6 Configuring a Web Server.
Web and Proxy Server.
Managing State Chapter 13.
Apache and... Virtual Hosts ---- aliases mod_rewrite ---- htaccess
The Hypertext Transfer Protocol
COMP2322 Lab 2 HTTP Steven Lee Feb. 8, 2017.

CSCI-351 Data communication and Networks
Presentation transcript:

Basics of the HTTP Protocol and Apache Web Server Brandon Checketts

At first there was HTTP 0.9 This is as simple as it can get GET Hello Created by Tim Berners-Lee in 1989(?) Created by Tim Berners-Lee in 1989(?) The 0.9 version number was actually created after the 1.0 spec The 0.9 version number was actually created after the 1.0 spec

HTTP 1.0 The first really practical revision of the HTTP protocol The first really practical revision of the HTTP protocol HTTP Request Headers and Response Headers HTTP Request Headers and Response Headers Simple caching Simple caching Authentication Authentication Content-Type Content-Type Sending data via POST Sending data via POST HTTP Status codes (200, 404, etc) HTTP Status codes (200, 404, etc)

HTTP 1.1 (in use today) Includes everything from HTTP 1.0 Includes everything from HTTP 1.0 Host header is required Host header is required Defines more status codes, more request methods Defines more status codes, more request methods Much more flexible caching available Much more flexible caching available Digest Authentication Digest Authentication

Sample HTTP Request / Response GET / HTTP/1.1 Host: User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: ) Gecko/ Firefox/3.5.3 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO ,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive HTTP/1.x 200 OK X-TR: 1 Date: Thu, 15 Oct :50:12 GMT Expires: -1 Cache-Control: private, max-age=0 Content-Type: text/html; charset=UTF-8 Set-Cookie: __utmv=; expires=Mon, 01-Jan :00:00 GMT; path=/; domain= Set-Cookie: __utmv=; expires=Mon, 01-Jan :00:00 GMT; path=/; domain=.google.com Server: gws X-XSS-Protection: 0 Content-Length: 9256

Headers of Interest Referer Referer Says which page referred you to the current URL Says which page referred you to the current URL Note the misspelling Note the misspelling Used in Analytics to provide a lot of useful metrics Used in Analytics to provide a lot of useful metrics User Agent User Agent Specifies OS and Browser (often faked) Specifies OS and Browser (often faked) Cookie / Set-Cookie (more on this later) Cookie / Set-Cookie (more on this later)

HTTP Cookies Cookies are generally good! They provide some incredibly useful functionality. Cookies are generally good! They provide some incredibly useful functionality. Server sends a Set-Cookie Server sends a Set-Cookie Client sends back a Cookie Client sends back a Cookie Demonstrate a cookie Demonstrate a cookie Be careful what you put in a cookie! Be careful what you put in a cookie! Don’t store user ID’s, authentication credentials, etc Don’t store user ID’s, authentication credentials, etc

Using Cookies to create sessions Without cookies, all HTTP requests are completely independent Without cookies, all HTTP requests are completely independent Cookies allow the server to add some persistence to multiple requests and create a session Cookies allow the server to add some persistence to multiple requests and create a session Most programming languages have some built-in support for sessions. (PHPSESSID, JSESSIONID, etc) Most programming languages have some built-in support for sessions. (PHPSESSID, JSESSIONID, etc) Session information can be stored in file system, database, memcache, etc. Session information can be stored in file system, database, memcache, etc. Don’t pass Session ID through GET requests Don’t pass Session ID through GET requests Demo some simple session examples: Demo some simple session examples:

Apache

Apache Web Server Apache is the most popular web server Apache is the most popular web server Wikipedia says it powers 55% of all websites and 66% of the biggest websites Wikipedia says it powers 55% of all websites and 66% of the biggest websites Derived from patches to NCSA httpd … ‘A Patchy’ Server Derived from patches to NCSA httpd … ‘A Patchy’ Server Modules provide a lot of extra functionality Modules provide a lot of extra functionality Some people complain that the modules add a lot of bloat Some people complain that the modules add a lot of bloat High Performance, very configurable, easily available. High Performance, very configurable, easily available. Virtual Hosts allow granular control of almost everything Virtual Hosts allow granular control of almost everything Hundreds and thousands of virtual hosts per physical host Hundreds and thousands of virtual hosts per physical host Worker (multi-threaded) versus Prefork (separate processes) Worker (multi-threaded) versus Prefork (separate processes) Version 2.2 is in wide use today Version 2.2 is in wide use today

Sample Apache VirtualHost Config NameVirtualHost :80 ServerName mydomain.com ServerName mydomain.com ServerAlias *.mydomain.com ServerAlias *.mydomain.com DocumentRoot /home/mydomain.com/www DocumentRoot /home/mydomain.com/www CustomLog /home/mydomain.com/logs/access_log combined CustomLog /home/mydomain.com/logs/access_log combined CustomLog /home/mydomain.com/logs/deflate_log deflate CustomLog /home/mydomain.com/logs/deflate_log deflate ErrorLog /home/mydomain.com/logs/error_log ErrorLog /home/mydomain.com/logs/error_log ScriptAlias /cgi-bin/ /home/mydomain.com/cgi-bin/ ScriptAlias /cgi-bin/ /home/mydomain.com/cgi-bin/ php_admin_flag engine on php_admin_flag engine on php_admin_value open_basedir "/home/mydomain.com/" php_admin_value open_basedir "/home/mydomain.com/" RewriteEngine On RewriteEngine On</VirtualHost>

Apache Modules Authentication (mod_auth_*) Authentication (mod_auth_*) Via MySQL (multiple applications single password database) Via MySQL (multiple applications single password database) Proxying (HTTP, AJP, load balancing) Proxying (HTTP, AJP, load balancing) Programs (mod_php, mod_python, mod_perl, passenger) Programs (mod_php, mod_python, mod_perl, passenger) SSL SSL URL rewriting (mod_rewrite) URL rewriting (mod_rewrite) CGI and Fast-CGI, SCGI CGI and Fast-CGI, SCGI WebDav WebDav SVN SVN Practically anything Practically anything ….mod_security… ….mod_security…

Apache Proxying Load Balancing Load Balancing BalancerMember BalancerMember BalancerMember BalancerMember ProxyPass /test balancer://mycluster/ ProxyPass /test balancer://mycluster/ Proxying Tomcat Proxying Tomcat ProxyPass /myapp ajp:// :8009/myapp/ ProxyPass /myapp ajp:// :8009/myapp/ ProxyPassReverse /myapp ajp:// :8009/myapp/ ProxyPassReverse /myapp ajp:// :8009/myapp/

mod_rewrite Used to create ‘pretty’ url’s Used to create ‘pretty’ url’s RewriteRule (.*).html /realpage.php?name=$1 Redirect any non-existant request to some page: Redirect any non-existant request to some page: RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule. /index.php [L]

Useful Apache Tricks /server-status/ /server-status/ apachectl –t –D DUMP_VHOSTS apachectl –t –D DUMP_VHOSTS Shows all of the virtual hosts configured Shows all of the virtual hosts configured Debian style setup with a2ensite, a2enmod Debian style setup with a2ensite, a2enmod Symlinks to enable/disable sites and modules Symlinks to enable/disable sites and modules Documentation is very good Documentation is very good

Apache Alternatives Nginx (Engine X) Nginx (Engine X) Supposed to be very good at proxying Supposed to be very good at proxying Lighttpd (Lighty) Lighttpd (Lighty)