Presentation is loading. Please wait.

Presentation is loading. Please wait.

Coursework 2: getting started (3) – hosting static web pages Chris Greenhalgh G54UBI / 2011-02-21.

Similar presentations


Presentation on theme: "Coursework 2: getting started (3) – hosting static web pages Chris Greenhalgh G54UBI / 2011-02-21."— Presentation transcript:

1 Coursework 2: getting started (3) – hosting static web pages Chris Greenhalgh G54UBI / 2011-02-21

2 Contents Hosting static web pages – In CS – On your own computer (optional) 2Chris Greenhalgh (cmg@cs.nott.ac.uk)

3 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/ 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/ 3Chris Greenhalgh (cmg@cs.nott.ac.uk)

4 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.html http://www.cs.nott.ac.uk/~cmg/G54UBI/mobile/Hello.html Check/set the file permissions, and enter the URL into the mobile browser (something like): – http://www.cs.nott.ac.uk/~USERNAME/Hello.html 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 4Chris Greenhalgh (cmg@cs.nott.ac.uk)

5 Test page 5 Hello Hello Hello.html Chris Greenhalgh (cmg@cs.nott.ac.uk)

6 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/ http://jetty.codehaus.org/jetty/ E.g. http://dist.codehaus.org/jetty/jetty-6.1.26/jetty-6.1.26.ziphttp://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)

7 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.html – If that works, try from the emulator… 7Chris Greenhalgh (cmg@cs.nott.ac.uk)

8 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 CANNOT – E.g.: http://localhost:8080/mobile/Hello.html or http://127.0.0.1:8080/mobile/Hello.htmlhttp://localhost:8080/mobile/Hello.html 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 8Chris Greenhalgh (cmg@cs.nott.ac.uk)

9 Conclusions You should now be able to: – Make “static” web pages available from your Computer Science account – View these files on the emulator browser – Optionally Serve static web pages from your own local web server, e.g. Jetty 9Chris Greenhalgh (cmg@cs.nott.ac.uk)


Download ppt "Coursework 2: getting started (3) – hosting static web pages Chris Greenhalgh G54UBI / 2011-02-21."

Similar presentations


Ads by Google