• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Why apache

 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi People,

I am unable to understand this. We have Tomcat as the servlet container of preference. Why do we use apache in spit of the fact that tomcat can handle the requests (I mean, tomcat can act like a web server).

So why do we use Apache web server?

Please help I am unable to think and understand why is it so.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The Apache web server (which is actually called httpd) can act as an SSL terminator, as a load-balancer for a cluster of Tomcat servers, and has many modules available that can do things Tomcat can't do (like run code in other languages like Perl or PHP). While it's not necessary for serving static content (Tomcat does that just fine), these other uses sometimes make it desirable to use.
 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

halwa raj wrote:
So why do we use Apache web server?



A number of reasons, although not everyone does use both Apache and Tomcat. Tomcat is easiest to configure and manage when using a named application context instead of just dumping the app under the root context ("/"). Apache makes it fairly simple to provide virtual hosts for each app where each virtual host serves up the Java webapp under its root context.

Apache has the ability that allows it to run as a user (non-root) process while still listening on port 80, which makes for a more secure system.

Apache supports multiple platforms, so if you have not only Java, but PHP, Perl, Python, binary cgi and more.

Apache has a lot of useful plug-in modules for things like proxying, URL rewriting and other infrastructure-supporting features.

At one time, Apache gave a significant boost to serving static resources such as images, but that's pretty much history now.
 
JavaMonitor Support
Posts: 251
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear All,

There is some discussion regarding this on http://java-monitor.com/forum/showthread.php?t=4 Scroll down to sippykup's contrubutions, he did a JavaOne presentation on this.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If your application is mostly servlet/jsp based, having an Apache front end is going to introduce extra delays and management complexity.

Bill
 
Rajkumar Katudia
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Holloway wrote:

halwa raj wrote:
So why do we use Apache web server?

Apache makes it fairly simple to provide virtual hosts ....



Really sorry but what is a virtual Host??? I am a new bee here...
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rajkumar Katudia wrote:I am a new bee here...


In that case, sticking your tongue out at people who might help you is probably not going to help your case ... just a bit of friendly advice.
 
Tim Holloway
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oh,

A Virtual Host is an alternative host residing on the same machine as the primary host. For example, if I had a vanity website - say http://www.paneercrackers.com and I wanted to run it as a virtual host on my primary mousetech.com web server box, I'd set up DNS to resolve www.paneercrackers.com to the IP address of that box and define a virtual host in Tomcat based on the www.paneercrackers.com hostname. It would then accept all URL requests targeting that hostname and dispatch them to the paneercrackers apps.

Originally, the primary aiming mechanism for web requests was the host's IP address, so an HTTP 1.0 request would basically consist of resolving the hostname to an IP address and then sending the request to the listener at that IP address. Virtual hosts make it possible for multiple websites to all be served by the same IP address and port.

If it seems like doing a raw http request by IP number instead of hostname would be confused as to which of those sites to target, you're right. So the rule is that the "real" host gets the request in that case.

And that's the way it is.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic