显示标签为“web”的博文。显示所有博文
显示标签为“web”的博文。显示所有博文

2012年1月14日星期六

RHEL5整合Apache+Tomcat,支持jsp与php - guolr - ITeye技术网站

RHEL5整合Apache+Tomcat,支持jsp与php - guolr - ITeye技术网站

  install tomcat
             yum install tomcat5 ( not yum install tomcat5-...-version )
             yum search webapp (and install manger and admin webapp)

   httpd:   /etc/httpd/conf/httpd.conf
               ProxyPass /mej http://ghost:8080/mej
               ProxyPass /bq http://ghost:8080/bq
               ProxyPass /mydemo http://ghost:8080/mydemo
               (must config for all java ee project)

   tomcat:  /etc/tomcat5/tomcat5.conf
               User tomcat
               Group tomcat
               CATALINA_HOME="/usr/share/tomcat5"
               DocumentRoot $CATALINA_HOME/webapps/ROOT/index.html
            /etc/tomcat5/server.xml
                <Context path="/me" docBase="/u/me/web"/>
                <Context path="/mej" docBase="/u/me/webj"/>
                <Context path="/bq" docBase="/u/me/webj/bq/WebContent"/>
                (must config all projects except those under tomcat webapps)
            /etc/tomcat5/tomcat-users.xml
                <role rolename="admin"/>
                <role rolename="manager"/>
                <user username="admin" password="admin" roles="admin,manager,tomcat"/>

   my httpd or tomcat5 http://ghost/mydemo     http://ghost:8080/mydemo  document: tomcat_webapps/mydemo
   my httpd or tomcat5 http://ghost/bq         http://ghost:8080/bq      document: ~/webj/bq/WebContent

2011年12月26日星期一

第19天第2节: 使用Tomcat搭建WEB开发环境

==Tomcat Install and Configure (http://www.coreservlets.com/Apache-Tomcat-Tutorial/)
-实现了JAVAEE标准的最小WEB服务器, Apache开发。
0. No separate Apache installation needed
1. Installed folders
    C:\Program Files (x86)\Apache Software Foundation\Tomcat 7.0
        bin/ : all tomcat binaries, including exe to start tomcat server
        lib/  : all java jar files used to compile and run java
        conf/ : configure, setting port, map between web dir and local dir
        log/:
        webapp/: all web project files, could be added by user. This is default web file location
        work/ : all temporary files including .java and .class, clean it if needed

2. Set JAVA_HOME pointing to JDK top dir. Tomcat use JD

3. Start tomcat:
     C:\Program Files (x86)\Apache Software Foundation\Tomcat 7.0\bin\Tomcat7.exe
4.  Check the web: http://localhost:8080/

5.  Further configuration
    5.1 (optional) webserver port. by server.xml

         <Connector port="8080" protocol="HTTP/1.1"  ==> port
    5.2 (optional but recommended) set map between web dir and local dir (virtual dir) ,
         a. create a local dir which has the following structure
             <application_root>/WEB-INF/web.xml  ( copy from webapps\ROOT\WEB-INF\web.xml)
         b. configure map on server.xml: Adding the following right before </Host>
                 <Context path="/demo" docBase="E:\linfa\work\webdemo"/>
                
                 Note: path is the path in the web browser, docBase is the path of files
    5.3 (optional but recommended on development) enable list files on dir. web.xml
            Fix: modify conf/web.xml: change "false" to "true"
                       <init-param>
                            <param-name>listings</param-name>
                             <param-value>false</param-value>
                       </init-param>
            restart the server, should have "Directory Listing For /"
    5.4 (optional but recommended on development) enable apps management on tomcat-user.xml: Adding the following
      <role rolename="admin"/>
       <role rolename="manager"/>
       <user username="admin" password="admin" roles="admin,manager,tomcat"/>

==The first jsp program
    1. creating E:\linfa\work\webdemo\hello.jsp  . jst file is adding java code into html file
    <html>
    <head>
        <title> Hello Jsp World!!!</title>
    </head>
    <body>
        <%
            out.println("Hello World with Newline<br>");
            out.println("Hello World without Newline");
        %>
    </body>
    </html>

==Under the hood
    


  1. The first time *.jsp->*.java->*.class->run *.class
  2. The second time *.jsp -> run *.class
  3. the *.java and *.class should be in tomcat work dir ( I could not find it?)