Shengdong Zhao - PowerPoint PPT Presentation

1 / 21
About This Presentation
Title:

Shengdong Zhao

Description:

Based on Rob McCool's NCSA web server (left to start Netscape 1994) ... Accept: text/xml,application/xml,application/xhtml xml,text/html;q=0.9,text ... – PowerPoint PPT presentation

Number of Views:47
Avg rating:3.0/5.0
Slides: 22
Provided by: Hua98
Category:
Tags: shengdong | xhtml | zhao

less

Transcript and Presenter's Notes

Title: Shengdong Zhao


1
Tutorial
  • Shengdong Zhao
  • http//www.dgp.toronto.edu/sszhao

(some slides are reused/modified from Neil
Ernsts apache tutorial)
2
History
  • Based on Rob McCools NCSA web server (left to
    start Netscape 1994)
  • 1st release (Apache 0.7.x) on April 1995 based on
    NSCA 1.3 server
  • Patches created for extensions and bug-fixes
    (Apache A-patchy Server)
  • Today 52.65 of all web server (July 07,
    www.netcraft.com)
  • 2 streams 1.3.x (very popular) 2.x (current)

3
(No Transcript)
4
Apache Architecture
http//plg.uwaterloo.ca/aeehassa/cs746/as1/apache
1.htm
5
Apache Architecture
  • Select module handler at install
  • Modules hook into phases in the Core processing
    cycle via API
  • Apache talks to clients use HTTP protocol
  • Client request GET /index.html
  • Apache maps request to a handler or file
  • Authenticate
  • Return content with headers
  • Modules can hook in at any point during the
    protocol

6
Headers
  • Check out the LiveHTTPHeaders extension for
    Firefox view the entire transaction.
  • Headers usually tell the client the status of the
    request, the mime-type of the content returned,
    the length, etc.
  • Allows the client to decide what to do.

7
(No Transcript)
8
  • GET / HTTP/1.1
  • Host www.yahoo.com
  • User-Agent Mozilla/5.0 (Windows U Windows NT
    5.1 en-US rv1.8.1.4) Gecko/20070515
    Firefox/2.0.0.4
  • Accept text/xml,application/xml,application/xhtml
    xml,text/htmlq0.9,text/plainq0.8,image/png,/
    q0.5
  • Accept-Language en-us,enq0.5
  • Accept-Encoding gzip,deflate
  • Accept-Charset ISO-8859-1,utf-8q0.7,q0.7
  • Keep-Alive 300
  • Connection keep-alive
  • Cookie
  • HTTP/1.x 200 OK
  • Date Tue, 10 Jul 2007 204716 GMT
  • P3P policyref"http//p3p.yahoo.com/w3c/p3p.xml",
    CP"CAO DSP COR CUR ADM DEV TAI PSA PSD IVAi
    IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi
    IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA
    POL HEA PRE GOV"
  • Cache-Control private
  • Vary User-Agent
  • Set-Cookie FPCMdeleted expiresMon, 10 Jul
    2006 204715 GMT path/
  • Set-Cookie
  • Connection close

9
Modules
  • The power of Apache is its modules
  • mod_ssl Secure internet transactions
  • mod_rewrite redirect agents elsewhere
  • mod_perl PERL language interface
  • mod_log_config logging
  • mod_include filter other modules

10
Apache on CDF
  • We run instances of the Apache server daemon
    (httpd) using our own config files (no install!)
    version 2.0.52
  • 1 course web page student guide Apache
    and follow the instructions
  • 2 download the tar file apache.tar.gz
  • 3 save it and untar it to a suitable folder,
    e.g. /309/ (tar xvzf apache.tar.gz)
  • 4 cd /309/apache/bin ./start.sh ltportnumgt
    This starts the server stop it using ./stop.sh
  • 5 verify ps u ltusergt grep httpd
  • 6 view lynx http//localhostltportnumgt/

11
(No Transcript)
12
(No Transcript)
13
(No Transcript)
14
Directory Structure
  • Bin the start and stop programs
  • Conf the config file for your server instances
  • Cgi-bin put executable scripts here
  • Logs error_log is any errors the server gets
    (404, 403), and access_log all accesses the
    server deals with
  • htdocs html files
  • E.g. see examples in each directory and play
    around

15
Configure Apache
  • Shouldnt need to change much in the /conf
    directory (mainly httpd.309.conf)
  • Can set your DocumentRoot in httpd.conf
  • DocumentRoot /where/you/want/to/put/your/docs
  • Can set your web admin e-mails
  • ServerAdmin you_at_your.address

16
Demo
17
Work at home
  • 1. Install and config Cygwin
  • http//www.cdf.toronto.edu/workathome/print.php3?i
    d76
  • 2. Double click Cygwin icon to start
  • 3. Type startx to start x window
  • 4. At the popup xterm, type ssh -X
    youraccount_at_cdf.utoronto.ca to login to your
    account

18
FAQs
  • Can I run this all at home, on Windows/Mac?
  • Sure. Apache even runs on Xbox. However, we mark
    assignments on CDF
  • How do I view my server on the internet?
  • http//ltXXXwolfgt.cdf.toronto.edultportnumgt
  • http//ltlocalmachinegt.cdf.toronto.edultportnumgt
    in the labs
  • My start/stop arent working?
  • Always start/stop directly in apache/bin to make
    sure paths work properly

19
Other references
  • The student guide on the course site
  • httpd.apache.org (e.g.)
  • http//httpd.apache.org/docs/1.3/howto/htaccess.ht
    ml
  • http//httpd.apache.org/docs/1.3/howto/auth.htmlb
    asic
  • Refcards.com Apache 1.3 reference card for
    printing (also other useful cards)
    http//refcards.com/docs/forda/apache/apache-refca
    rd-a4.pdf

20
.htaccess files
  • Use .htaccess files
  • These are read per-directory (affect subs) by the
    server and can contain many things
  • Security restrictions
  • Redirects
  • URL rewrites

21
.htaccess files sample format
  • order allow, deny
  • deny from 123.45.6.7
  • deny from 012.34.5
  • Allow from all
  • AuthUserFile /
  • user/local/you/safedir/.htpasswd
  • AuthGroupFile /dev/null
  • AuthName EnterPassword
  • AuthType Basic
  • Require user wsabstract
Write a Comment
User Comments (0)
About PowerShow.com