user697911
user697911

Reputation: 10561

how to organize files in Tomcat and Apache server?

I just installed both Apache server and Tomcat, and I read that I should put static html pages in Apache and put dynamic pages, like JSP, Servlets, and all other full Java applications in Tomcat. Specifically, where should they go respectively?

For instance, should html files be placed under /var/www/html? And all other files under /opt/apache-tomcat-7.0.34/webapps/?

Any tutorial for this? Thanks a lot.

Upvotes: 1

Views: 374

Answers (1)

Olaf Kock
Olaf Kock

Reputation: 48087

The typical ways to forward requests from Apache to Tomcat involve the use of mod_proxy, mod_proxy_ajp or mod_jk (there might be more). All of them are well documented and basically involve requests that hit your Apache to be forwarded to tomcat if they match certain criteria (like path names) - all nonmatching requests will be handled by Apache, however you configure this one.

However, I'm seconding on JB Nizet's comment: Dividing the serving of different content to Apache and Tomcat is an optimization. It's arguable if you should add this complexity (not that it's too complex, but it's more to do than not separating it) when you don't have the need. E.g. if your nonoptimized website can handle 1000 concurrent users, but you'll rarely have more than 10 - don't bother.

Upvotes: 0

Related Questions