How to set up HTTP server and Web Page

W
Document Sample
scope of work template
							          How to set up HTTP server and
                   Web Page?

                             Lecturer: Qixin Wang




Department of Computing, Hong Kong Polytechnic Univ.   Slide 1
       Basic interaction btw Web Server and
       Client over HTTP
       Static documents




Department of Computing, Hong Kong Polytechnic Univ.   Slide 2
     Configuring Apache Web Server
/etc/httpd/conf/httpd.conf

...
<IfModule mod_useridr.c>
  ...
  # UserDir disable
  ...
  UserDir public_html
  ...
</IfModule>
...




To allow per user “public_html” directory mapping


Department of Computing, Hong Kong Polytechnic Univ.   Slide 3
     Starting/Restarting/Stopping Apache

/etc/init.d:>./httpd start


/etc/init.d:>./httpd restart


/etc/init.d:>./httpd stop




Department of Computing, Hong Kong Polytechnic Univ.   Slide 4
       URL Mapping, assuming Apache server, on
       www.comp.polyu.edu.hk
/home/csqwang/public_html/index.html
/home/csqwang/public_html/a.html                         Minimum Access Right:

/home/csqwang/public_html/a.gif                          Directory: r-xr-xr-x
                                                         File: r--r--r--
/home/csqwang/public_html/bdir/index.html
/home/csqwang/public_html/bdir/c.html


                       respectively map to


http://www.comp.polyu.edu.hk/~csqwang/index.html
http://www.comp.polyu.edu.hk/~csqwang/a.html

http://www.comp.polyu.edu.hk/~csqwang/a.gif

http://www.comp.polyu.edu.hk/~csqwang/bdir/index.html
http://www.comp.polyu.edu.hk/~csqwang/bdir/c.html
  Department of Computing, Hong Kong Polytechnic Univ.                     Slide 5
       Apache also provides each index.html file another
       special mapping
/home/csqwang/public_html/index.html
/home/csqwang/public_html/a.html

/home/csqwang/public_html/a.gif

/home/csqwang/public_html/bdir/index.html
/home/csqwang/public_html/bdir/c.html


                       respectively map to


http://www.comp.polyu.edu.hk/~csqwang/
http://www.comp.polyu.edu.hk/~csqwang/a.html

http://www.comp.polyu.edu.hk/~csqwang/a.gif

http://www.comp.polyu.edu.hk/~csqwang/bdir/
http://www.comp.polyu.edu.hk/~csqwang/bdir/c.html
  Department of Computing, Hong Kong Polytechnic Univ.   Slide 6
          Relative URL example: how to write a hyper link
          to c.html in a.html
a.html:

<a href=“http://www.comp.polyu.edu.hk/~csqwang/bdir/c.html”>link</a>



a.html:

<a href=“bdir/c.html”>link</a>


/home/csqwang/public_html/a.html

/home/csqwang/public_html/a.gif
/home/csqwang/public_html/bdir/c.html

             respectively map to
http://www.comp.polyu.edu.hk/~csqwang/a.html

http://www.comp.polyu.edu.hk/~csqwang/a.gif
http://www.comp.polyu.edu.hk/~csqwang/bdir/c.html
  Department of Computing, Hong Kong Polytechnic Univ.            Slide 7
          Relative URL example: how to write a hyper link
          to c.html in a.html
a.html:

<a href=“http://www.comp.polyu.edu.hk/~csqwang/bdir/c.html”>link</a>



a.html:

<a href=“bdir/c.html”>link</a>                               absolute URL
/home/csqwang/public_html/a.html

/home/csqwang/public_html/a.gif
/home/csqwang/public_html/bdir/c.html

             respectively map to
http://www.comp.polyu.edu.hk/~csqwang/a.html

http://www.comp.polyu.edu.hk/~csqwang/a.gif
http://www.comp.polyu.edu.hk/~csqwang/bdir/c.html
  Department of Computing, Hong Kong Polytechnic Univ.            Slide 8
          Relative URL example: how to write a hyper link
          to c.html in a.html
a.html:

<a href=“http://www.comp.polyu.edu.hk/~csqwang/bdir/c.html”>link</a>



a.html:

<a href=“bdir/c.html”>link</a>                                          absolute URL
/home/csqwang/public_html/a.html
                                                         relative URL
/home/csqwang/public_html/a.gif
/home/csqwang/public_html/bdir/c.html

             respectively map to
http://www.comp.polyu.edu.hk/~csqwang/a.html

http://www.comp.polyu.edu.hk/~csqwang/a.gif
http://www.comp.polyu.edu.hk/~csqwang/bdir/c.html
  Department of Computing, Hong Kong Polytechnic Univ.                     Slide 9
          Relative URL example: how to write a hyper link
          to a.html in c.html
c.html:

<a href=“http://www.comp.polyu.edu.hk/~csqwang/a.html”>link</a>



c.html:

<a href=“../a.html”>link</a>                                            absolute URL
/home/csqwang/public_html/a.html
                                                         relative URL
/home/csqwang/public_html/a.gif
/home/csqwang/public_html/bdir/c.html

             respectively map to
http://www.comp.polyu.edu.hk/~csqwang/a.html

http://www.comp.polyu.edu.hk/~csqwang/a.gif
http://www.comp.polyu.edu.hk/~csqwang/bdir/c.html
  Department of Computing, Hong Kong Polytechnic Univ.                     Slide 10
     How to set up web page using the
     department’s web server




Department of Computing, Hong Kong Polytechnic Univ.   Slide 11
     How to set up web page using the
     department’s web server




Department of Computing, Hong Kong Polytechnic Univ.   Slide 12
     How to set up web page using the
     department’s web server




Department of Computing, Hong Kong Polytechnic Univ.   Slide 13
     How to set up web page using the
     department’s web server




Department of Computing, Hong Kong Polytechnic Univ.   Slide 14

						
Related docs