From: http://hi.baidu.com/leivaan/blog/item/05710a82fa51e6a60df4d254.html
I often use Apache, tomcat, and other servers, but I still don't know the relationship between them. I am confused when I use tomcat, in the end, who is the primary user and who is the secondary user? Therefore, I found some materials on the Internet and summarized them as follows:
I
Apache supports static pages. Tomcat supports dynamic pages, such as servlets,
If Apache + Tomcat is used, Apache is only used as a forward object, and JSP processing is handled by Tomcat.
Apache supports PHP, CGI, and Perl, but to use Java, you need to support tomcat in the Apache background to forward Java requests to Tomcat for processing.
ApacheYes Web Server, TomcatIs an application (Java) server. It is just a servlet (JSP is also translated into servlet) container and can be consideredApacheBut can be independentApacheRun.
The two have the following points for comparison:
1. Both are developed by Apache.
2. Both have HTTP service functions
3. Both are free.
Differences:
Apache provides HTTP services and related configurations (such as virtual hosts and URL forwarding)
Tomcat is a JSP server developed by Apache in compliance with J2EE JSP and Servlet standards.
II:
Apache is a web server environmentProgramIt can be used as a Web server, but it does not support dynamic webpages such as (Asp, PHP, CGI, JSP ).
If you want to run JSP in Apache, you need an interpreter to execute the JSP webpage. This JSP interpreter is tomcat. Why JDK? If JSP needs to connect to the database, JDK is required to provide a path to connect to the database. Therefore, Apache + Tomcat + JDK is required to run the JSP web server platform.
The benefits of integration are:
If the client requests a static page, the Apache server only needs to respond to the request.
If the client requests a dynamic page, the Tomcat server responds to the request.
Because JSP is server-side explanationCodeSo that integration can reduce Tomcat service overhead
III:
Apache: focuses on HTTP Server
Tomcat: focuses on the servlet engine. If it runs in standalone mode, it is functionally equivalent to Apache and supports JSP, but it is not ideal for static web pages;
Apache is a Web server, and Tomcat is an application (Java) server. It is just a servlet (JSP is also translated into servlet) container. It can be considered as an extension of Apache, but it can run independently of Apache.
In other words, Apache is a truck with some things such as HTML. But you cannot hold water. To hold water, you must have a container (bucket) instead of a truck.