日期:2014-05-16  浏览次数:20760 次

ubuntu 9.10下apache2.2.12 tomcat6.0.20 虚拟主机整合总结



0.缺省apache2和tomcat6都是装好的,只需装mod_jk
1.apt-get install libapache2-mod-jk
2.a2enmod jk
3.修改default,增加对该虚拟主机对jsp的解释
JkMount /* ajp13
4.修改 tomcat6 server.xml 文件
  增加对网站根目录的重新指定
5./etc/init.d/apache2 restart;/etc/init.d/tomcat6 restart
6.测试一下servlet环境
package test;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import static java.lang.System.out;

public class HelloServlet extends HttpServlet
{
  public void doGet(HttpServletRequest request,HttpServletResponse response) 
    throws ServletException,IOException
  {
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    out.println("<html><head><title>This is my first Servlet</title></head>");
    out.println("<body><div align='center' style='text-align:center;display:block;width:200px;height:30px;border:1px solid #ff00ff;'>");
    out.println("Hello,Servlet World!</div></body></html>");
  }
}

/**
 *2010-5-2 07:29:18
 *Conclusion:
 */





reference:
1.http://blog.ossxp.com/2010/01/312/
2.http://energykey.iteye.com/blog/505056