/
Coursework 2: getting started (3) – hosting static web pa Coursework 2: getting started (3) – hosting static web pa

Coursework 2: getting started (3) – hosting static web pa - PowerPoint Presentation

ellena-manuel
ellena-manuel . @ellena-manuel
Follow
395 views
Uploaded On 2016-05-18

Coursework 2: getting started (3) – hosting static web pa - PPT Presentation

Chris Greenhalgh G54UBI 20110221 Contents Hosting static web pages In CS On your own computer optional 2 Chris Greenhalgh cmgcsnottacuk Hosting static web pages in CS Follow these instructions to set up hosting for static ie no serverside scripting web pages on the CS ser ID: 324447

nott jetty web http jetty nott http web cmg chris greenhalgh mobile pages local html server hosting static access

Share:

Link:

Embed:

Download Presentation from below link

Download Presentation The PPT/PDF document "Coursework 2: getting started (3) – ho..." is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

Slide1

Coursework 2: getting started (3) – hosting static web pages

Chris Greenhalgh

G54UBI / 2011-02-21Slide2

Contents

Hosting static web pages

In CS

On your own computer (optional)

2

Chris Greenhalgh (cmg@cs.nott.ac.uk)Slide3

Hosting static web pages in CS

Follow these instructions to set up hosting for static (i.e. no server-side scripting) web pages on the CS server(

s

):

http://support.cs.nott.ac.uk/help/docs/webpages/static/

For general information about accessing/using the UNIX servers see

http://support.cs.nott.ac.uk/help/docs/access/unix/

3

Chris Greenhalgh (cmg@cs.nott.ac.uk)Slide4

A first test page

Download this simple page or create it using an editor in your

public_html

directory:

http://www.cs.nott.ac.uk/~cmg/G54UBI/mobile/Hello.htmlCheck/set the file permissions, and enter the URL into the mobile browser (something like):

http://www.cs.nott.ac.uk/~USERNAME/Hello.html

Errors can include:

Forbidden => file or directory permission wrong, or outside University network (see document)

Not found => URL hostname, path or filename wrong

4

Chris Greenhalgh (cmg@cs.nott.ac.uk)Slide5

Test page

5

<!DOCTYPE html PUBLIC

"-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

<head>

<title>Hello</title>

</head>

<body>

<h1>Hello</h1>

</body>

</html>

Hello.html

Chris Greenhalgh (cmg@cs.nott.ac.uk)Slide6

Hosting pages on your own computer (optional)

If you already have a web server set up (e.g. Apache) then use it

Alternatively e.g. Jetty is a simple Java HTTP server:

http://jetty.codehaus.org/jetty/

E.g.

http://dist.codehaus.org/jetty/jetty-6.1.26/jetty-6.1.26.zip

Extract the zip file to a directory

Create a new sub-directory under jetty-X.X.X/ called mobile/Copy this file to jetty-X.X.X/contexts/:

http://www.cs.nott.ac.uk/~cmg/G54UBI/mobile/mobile.xml

Put your web pages in the new mobile/ directory

Run Jetty

Double click jetty-X.X.X/

start.jar

or run in command shell with “java –jar

start.jar

”6Chris Greenhalgh (cmg@cs.nott.ac.uk)Slide7

Using Jetty (or another local server), cont.

To check/access files served by Jetty:

When run, eventually it should print something like

2011-02-22 15:34:33.127:INFO::Started SelectChannelConnector@0.0.0.0:

8080

Note the “:8080” at the end; this is the port it is using

Check the IP address of you computer, e.g. Windows (in a command shell) “

ipconfig

”, *nix “ifconfig –a”, e.g.

IP Address. . . . . . . :

128.243.22.74

From a desktop browser first, try to access the file, e.g.

http://

128.243.22.74

:

8080

/mobile/Hello.htmlIf that works, try from the emulator…7Chris Greenhalgh (cmg@cs.nott.ac.uk)Slide8

Possible problems with local hosting

Local firewall settings, e.g. windows firewall

Try configuring an “exception” for port 8080 and/or the Jetty program in the firewall

If you are inside the University and using the University proxy then it will NOT allow access back to your local machine

Temporarily disable the proxy by setting environment variable

HTTP_proxy

to (e.g.) “DIRECT” and restart the emulator. Note: you will probably NOT be able to access external web sites (including Google Maps) now.

Note that a local browser can use a “

localhost” URL to access a local web server but the emulator CANNOTE.g.: http://localhost:8080/mobile/Hello.html

or

http://127.0.0.1:8080/mobile/Hello.html

The emulator’s “

localhost

” is the emulator itself, not the computer that it is running on

8

Chris Greenhalgh (cmg@cs.nott.ac.uk)Slide9

Conclusions

You should now be able to:

Make “static” web pages available from your Computer Science account

View these files on the emulator browser

OptionallyServe static web pages from your own local web server, e.g. Jetty

9

Chris Greenhalgh (cmg@cs.nott.ac.uk)