Ive read so often that an Apache Webserver should be installed before an tomcat to achieve better performance. They say. that tomcat can't provide static files as well a开发者_运维技巧s the Apache.
I would like to understand how it works in detail. I researched the internet, but I didnt find any good explanation.
- A client sends a request
- The request goes to the Apache
- If the request is for a static file, the Apache gets the static file and gives it back to the client
- If the request is for a dynamic file (like jsp), the apache gives the request to the tomcat
- the tomcat generates the file
- the tomcat gives the response back to the Apache
- Apache sends to response to the user
Is that correct??? Or do requests for static files also go to the Tomcat? Then why is Apache needed?
Thanks for clarifying it :-)
Yes you got it pretty much right. Static requests are usually served by Apache and not forwarded to Tomcat server.
You can use mod_jk or mod_proxy_ajp to forward your dynamic requests to Tomcat.
Another advantage of using Apache in front is load bakancing of your traffic.
精彩评论