APPENDIX C

image

Deploy Web Application

The sections in this appendix explain how to:

  • Install and set up the Open Source Apache Tomcat web server
  • Install Microsoft Internet Information Services (IIS)
  • Deploy the web application

These instructions are for the Windows 64-bit operating system. Similar instructions can be used to install the web server and deploy the web application on other operating systems. You need to install and set up either Tomcat or IIS.

After the web application is deployed using the instructions in this appendix, you can test your web applications from other computers and from your mobile devices, as long as they are connected to the same network as your web server. If you are not able to access your web page on your mobile device, go to the URL locally on your web server. If you can see the page from your server but not from your mobile device, check that:

  • The web server and the mobile device are connected to the same local router through an Ethernet cable or via WiFi.
  • There is no firewall on the web server blocking the traffic.

C-1. Prerequisite: Downloading Java 7 JRE

To download Java 7 JRE:

  1. Go to http://www.oracle.com/technetwork/java/javase/downloads/ and select the JRE Download button under Java SE 7u60.
  2. Check the Accept License Agreement radio button.
  3. Click the download link for jre-7u60-windows-x64.exe for Windows 64.
  4. Save the file.
  5. Double-click the saved file (jre-7u60-windows-x64.exe). The default install location is C:Program FilesJavajre7. Click the Install > button.
  6. After Java is successfully installed, click the Close button.

To verify that Java JRE is installed properly, open the MS-DOS prompt and enter the java -version command. You should see the following output:

java version "1.7.0_60"
Java(TM) SE Runtime Environment (build 1.7.0_60-b19)
Java HotSpot(TM) 64-Bit Server VM (build 24.60-b09, mixed mode)

You need to verify that the JRE_HOME environment variable is set properly. Go to Windows operating system’s Control Panel by choosing Systems and Security image System image Advanced System Settings image Advanced tab image Environment Variables. If JRE_HOME is not set properly, set it by clicking New:

Variable name: JRE_HOME
Variable value: C:Program FilesJavajre7

C-2. Downloading and Installing Apache Tomcat

To download Apache Tomcat, follow these steps:

  1. Go to http://tomcat.apache.org.
  2. Click on the latest version of Tomcat.

    At the time of writing of this book, the latest version is 8.0.9. Click on Tomcat 8.0 under the Download section and then click on 64-bit Windows zip (pgp, md5) under the 8.0.9 – Binary Distributions – Core section.

  3. Save the ZIP file.
  4. After the download is complete, unzip the file in a folder of your choice (for example, C:). The following becomes the home directory for Tomcat: C:apache-tomcat-8.0.9.

C-3. Starting and Stopping the Tomcat Server

To start the Tomcat web server, follow these steps:

  1. Go to C:apache-tomcat-8.0.9in.
  2. Double-click startup.bat.

    If the prerequisite is met and there is no issue with the setup, you should see the last line of the output as:

    13-Jul-2014 19:42:15.347 INFO [main] org.apache.catalina.startup.Catalina.start
    Server startup in 577 ms

    This indicates that the server has started successfully.

  3. To verify that web server has started successfully, go to http://localhost:8080. You should be able to see the Tomcat page.

If no MS-DOS prompt window is displayed and the startup.bat file gets terminated immediately, update the startup.bat file with the pause command at the end of the file. This will keep the MS-DOS prompt window open and display the error message.

To stop the Tomcat web server, follow these steps:

  1. Go to C:apache-tomcat-8.0.9in.
  2. Double-click shutdown.bat.

C-4. Deploying the Web Application on the Tomcat Server

To deploy the web application on the Tomcat server, follow these steps:

  1. Create your web application folder under C:apache-tomcat-8.0.9webapps (for example, jQueryLearn).
  2. Copy all the folders and files from your web application root folder to C:apache-tomcat-8.0.9webappsjQueryLearn.
  3. To verify access to your web application using the web server, go to http://localhost:8080/jQueryLearn/myPage.htm, where myPage.htm is one of your HTML files.

If you can access your page that means your web application is deployed properly.

C-5. Installing IIS (Internet Information Services)

To install IIS, you need to log on with administrator rights. The following instructions are for deploying the web application on IIS 7.0 (or 7.5) under the Windows 8 operating system. Similar instructions can be used for Windows 7 and Windows 2008 server.

  1. Go to Control Panel image Programs image Turn Windows on or off. Figure C-1 shows if the IIS is installed.

    9781430264330_AppC-01.jpg

    Figure C-1. IIS installation status

  2. If World Wide Web Services under Internet Information Services is not checked, check it and then click OK to install IIS.
  3. After installation is completed, go to http://localhost/. You should see the default IIS page. Figure C-2 displays this default page.

9781430264330_AppC-02.jpg

Figure C-2. Default IIS page

C-6. Deploying the Web Application on the IIS Server

To deploy the web application on the IIS server:

  1. Log on with administrator rights.
  2. Create your web application folder under C:inetpubwwwroot (for example, jQueryLearn).
  3. Copy all the folders and files from your web application root folder to C:inetpubwwwrootjQueryLearn.
  4. Run IIS Manager using the following command:
    C:windowssystem32inetsrvInetMgr.exe

    On the left panel, expand your computer name and choose Sites. Right-click on Default Web Site and then click Add Application.

    Figure C-3 displays the Add Application settings. After entering an Alias and a Physical Path, click OK.

    9781430264330_AppC-03.jpg

    Figure C-3. The Add Application settings

  5. To verify access to your web application using the web server, go to http://localhost/jQueryLearn/myPage.htm, where myPage.htm is any of your HTML files.

If you can access your page that means your web application is deployed properly.

C-7. Accessing a Deployed Web Application

You can deploy your mobile web application on the Tomcat web server (or IIS) and test your web pages on your mobile device by following these steps:

  1. Get the IP address of your computer on which web server is installed. For example, for the Windows operating system, enter ipconfig into the MS-DOS prompt window. Look for the IPv4 (or IPv6) address to get the IP address of the computer.
  2. Use the mobile device to test the mobile web application. Say your server IP address is 192.168.1.72. On your mobile device, open a web browser and enter the URL. If the web application is deployed on Apache Tomcat, use:
    http://192.168.1.72:8080/jQueryLearn/myPage.htm

    If the web application is deployed on IIS, use:

    http://192.168.1.72/jQueryLearn/myPage.htm

    You should be able to see your web page on your mobile device. If you have any issue accessing web pages from the mobile device, check that the web server is running and that the server and the mobile device are connected to the same local router through an Ethernet cable or via WiFi.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.137.67