Apache & Tomcat

  Both Apache and Tomcat are web servers, and they are both related and different. In the development process of HTML, PHP, JSP, Perl, etc., it is necessary to accurately grasp their respective characteristics and choose the best server configuration.

  Apache is a web server (static parsing, such as HTML), and tomcat is a java application server (dynamic parsing, such as JSP, PHP)

  Tomcat is just a servlet (jsp is also translated into servlet) container, which can be considered as an extension of apache, but can be run independently of apache

  


==The two can be compared from the following points==

  1. Both are developed by apache organization
  2. Both have the function of HTTP service
  3. Both are open source and free

    connect

    1)Apache是普通服务器,本身只支持html即普通网页,可以通过插件支持php,还可以与Tomcat连通(Apache单向连接Tomcat,就是说通过Apache可以访问Tomcat资源,反之不然)。  
    2)Apache只支持静态网页,但像asp、jsp、php、cgi等动态网页就需要Tomcat来处理。
    3)Apache和Tomcat整合使用:
    如果客户端请求的是静态页面,则只需要Apache服务器响应请求;
    如果客户端请求动态页面,则是Tomcat服务器响应请求,将解析的JSP等网页代码解析后回传给Apache服务器,再经Apache返回给浏览器端。
    这是因为jsp是服务器端解释代码的,Tomcat只做动态代码解析,Apache回传解析好的静态代码,Apache+Tomcat这样整合就可以减少Tomcat的服务开销。
    4)Apache和Tomcat是独立的,在同一台服务器上可以集成。

    the difference

      Apache is implemented in C language and supports various features and modules to extend the core functions; Tomcat is written in Java and better supports Servlet and JSP.
  • Apache is a web server. The web server serves pages so that browsers can browse. The web server specializes in handling HTTP requests, but the application server provides (serves) business logic for applications through many protocols. .
      Tomcat is an application server running on Apache, and the application server provides methods that client applications can call (call). It is just a servlet (jsp is also translated into servlet) container, which can be considered as an extension of Apache, but can run independently of apache.
  • Apache is an ordinary server, and it only supports html static ordinary web pages. However, it can support PHP through plug-ins, and can also connect with Tomcat (one-way Apache connection to Tomcat, that is, Tomcat resources can be accessed through Apache, and vice versa), Tomcat is a jsp/servlet container, and also supports HTML, JSP, ASP, PHP, CGI etc, where CGI requires some manual debugging, but it's easy.
  • Apache focuses on http server, and Tomcat focuses on servlet engine. If it runs in standalone mode, Tomcat and apache support JSP equivalently in function, but it is not ideal for static web pages.
  • Apache can run for a year without restarting, and the stability is very good, while Tomcat is not necessarily so.
  • The preferred web server is Apache, but tomcat is used for jsp and servlet that cannot be parsed by Apache.
  • Apache is the very first page parsing service. Tomcat was developed later. In essence, the function of tomcat can completely replace Apache, but Apache is the predecessor of tomcat after all, and many people in the market are still using Apache. , so Apache will continue to exist and will not be replaced. Apache cannot parse java things, but it parses html quickly.

    Both examples:

      Apache是一辆车,上面可以装一些东西如html等,但是不能装水,要装水必须要有容器(桶),而这个桶也可以不放在卡车上,那这个桶就是TOMCAT。
    两者整合:
      Apache是一个web服务器环境程序,启用他可以作为web服务器使用不过只支持静态网页,不支持动态网页,如asp、jsp、php、cgi
      如果要在Apache环境下运行jsp就需要一个解释器来执行jsp网页,而这个jsp解释器就是Tomcat
      那为什么还要JDK呢?因为jsp需要连接数据库的话就要jdk来提供连接数据库的驱程,所以要运行jsp的web服务器平台就需要APACHE+TOMCAT+JDK
    整合的好处:
      如果客户端请求的是静态页面,则只需要Apache服务器响应请求
      如果客户端请求动态页面,则是Tomcat服务器响应请求
      因为jsp是服务器端解释代码的,这样整合就可以减少Tomcat的服务开销

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325361407&siteId=291194637