Usage difference between Apache and Apache Tomcat - apache

As Tomcat is a widely used java web server, and Apache is also a web server, what's the different between them in real project usage?
After some research, I got a simple idea like,
Apache Tomcat <=> For java fans
Apache <=> More general web server, eg. PHP:XAMPP,LAMP

The differences between Apache and Apache Tomcat are:
Apache:
It is developed in C.
It is an HTTP server. That means that it serves files through HTTP protocol.
It can host applications coded in any programming languages, not just Java.
It is capable of request/response processing and load balancing.
It can generally handle requests for static html pages. However, it can still handle dynamic requests for pages coded in languages like PHP, Perl and Ruby.
Apache Tomcat:
It is developed in Java.
It is a JSP/Servlet container. That means it handles the lifecycle for servlets.
It is supposed to host applications those are coded in Java. However, it can also execute Perl scripts.
Beyond the basic request/response processing, it can also manage the entire JSP/Servlet lifecycle.
It can handle both static and dynamic content. The static page are generated using HTML, while the dynamic content are generated using Servlet and JSP.

Apache is more for a static web site with basic functions.
Apache tomcat is container above Apache which can used with Java backend project.
They can be used separately or run together.

Apache - It's a web server, which helps in serving static content mostly. But, it can also handle dynamic requests for pages coded in languages like PHP, Perl and Ruby.
Tomcat - It's an application server, which helps in deploying dynamic content using Java.
Apache Tomcat - Here, both are used in conjunction where Apache serves static content, and forwarding the requests for dynamic content to Tomcat.
Content refers to web pages.

Related

Apache web server with tomcat

We have a java web application with gradle build configuration which contains 2 modules as below:
project-web.war -- contains all statc files, js, jsp, etc. Also it contains all the project, spring configuration with rest controller layer.
project-main.jar -- contains all the business & DAO layer logic.
Currently we are deploying both of these modules in Apache tomcat. Our project is going through with some architectural changes & one of the requirement is to add all the static content in Apache server so that static content can be served quickly.
I am beginner in regard to Apache http web server. I have below questions:
If I put all the static contents in Apache http server, then can I remove all the static contents from project-web? Can both of these project exist separately?
Going forward static content of project will be in Apache http web server and web app will be deployed in Apache tomcat, in addition both of these server will be in different VM machine. How web app in tomcat can access static content from Apache web server in different VM machine?(E.g. how jsp can point to images?)
Would it be fine idea to create a separate project for just static content as it will independent of web project in future and just need to be deployed in Apache http server?
Answers for above questions will be appreciable & other related suggestions are also welcome. Thanks!
1) If I put all the static contents in Apache http server, then can I remove all the static contents from project-web?
Yes.
Can both of these project exist separately?
They can, but the stuff in the webapp will (should) never be accessed so what would be the point?
2) Going forward static content of project will be in Apache http web server and web app will be deployed in Apache tomcat, in addition both of these server will be in different VM machine. How web app in tomcat can access static content from Apache web server in different VM machine?(E.g. how jsp can point to images?)
The webapp doesn't need to access the images. The browser needs to access the images. The Apache HTTPD configuration can be set up to take care of that transparently without requiring any JSP changes.
3) Would it be fine idea to create a separate project for just static content as it will independent of web project in future and just need to be deployed in Apache http server?
Yes.

Using mod_security, either with Apache 2.4 or with mod_proxy as a reverse proxy

I would like to setup mod_security as a stand alone instance protecting Tomcat instances against web application attacks. Would anyone know the pros and cons of doing this via installing mod_security as an Apache module versus installing mod_security on a reverse proxy? Has anyone implemented mod_security in either of these fashions? And if so is one preferred over the other?
There's really no difference in your two options. What non reverse proxy would you install the module on to protect Tomcat?
The question doesn't really make sense as they are both the same to you.
If you already have an Apache server, then you install ModSecurity in one of two ways:
In embedded mode by installing ModSecurity as module in the existing Apache instance you already have. The advantages are that you won't have to set up a separate Apache instance, and that the ModSecurity will have access to the environment that Apache runs under (so can see environment variables for example or log to same log files).
In a reverse proxy mode. This involves setting up a separate Apache instance, with ModSecurity on it only, and funnel all requests through it, before sending on the requests to your normal Apache. The advantages here are a dedicated web server just for ModSecurity, so you will not share resources with your existing version of Apache, if it is already resource hungry. Disadvantages are that it doubles your infrastructure and the complications that brings.
Personally I prefer option 1.
However, as you want to set up a dedicated web server in front of TomCat, the two options are identical for you. The new instance of Apache (or Nginx) that you set up will be running it in embedded mode and will act as a reverse proxy to your Tomcat server.
Personally I always think it's best to run a dedicated web server like Apache in front of any app server like Tomcat - especially on a public facing website. Granted Tomcat does include a pretty good web server (called Coyote), which may serve most of your web server needs, but a dedicated web server like Apache is more geared towards serving static content and contains other features for performance and security which make it a better end point server (including the ability to run ModSecurity for example!).
And just in case there is any confusion, Apache is actually short for Apache HTTP Server, and is sometimes called Apache httpd after the process that it runs. It is Apache's most popular bit of software hence why the name gets shortened, but Apache actually have lots of bits of software (including Apache Tomcat - usually shortened just to Tomcat).

When to Use Apache vs. Apache+Tomcat?

Since simply using Apache can be enough to run many Web applications, when and why do people also use Tomcat in addition to Apache?
Apache Tomcat is a webserver and Java servlet container in one, while Apache HTTPD is just a plain webserver (often with only PHP support). They use Apache Tomcat when they want be able to run Java/JSP/Servlet. It can be added to an existing Apache HTTPD / PHP setup. Or the other way round, they bring Apache HTTPD in front of Apache Tomcat to be able to have a "This site is in maintenance" page when Tomcat is been shutdown for some upgrade/maintenance.
For communication between Apache HTTPD and Apache Tomcat, the Tomcat Connector is usually been used. It's also known as mod_jk.
Maybe too late to answer.
"Apache" is the name of a foundation that write open-source software. Apache HTTPD is a web server written in portable C (when people say "Apache", they usually mean Apache HTTPD.) It mostly serves static content by itself, but there are many add-on modules (some of which come with Apache itself) that let it modify the content and also serve dynamic content written in Perl, PHP, Python, Ruby, or other languages.
Tomcat is primarily a servlet/JSP container. It's written in Java. It can serve static content, too, but its main purpose is to host servlets and JSPs. Although it's possible to get Tomcat to run Perl scripts and the like, you wouldn't use Tomcat unless most of your content was Java.
It's actually possible to use both Apache and Tomcat together, so that Apache serves the static content, and Tomcat the Servlets and JSPs. Depending on various factors, this may or may not be a good idea.

Is Apache Tomcat built on Apache Web Server platform?

Recently our Software Analytic provider (NETTRACKER) sent us a plugin in order to be able to capture visitors in a better way. This plugin is for Apache 1.x and Apache 2.x. They said and I quote
that since Apache Tomcat is built on Apache HTTP server the configuration of the plugin should be the same.
I have looked for a httpd.conf in our tomcat deployment but we cannot find one, the only configuration that is similar to that one is the server.xml under the /conf directory.
If someone has better information regarding these two incredible products (Apache HTTP server and Apache Tomcat) I will greatly appreciate to draw the differences.
EDIT:
In case you are curious we know that Apache Web Server and Tomcat can work together using the mod_jk option and other proxys. But this will be too complex for our deployment.
Apache Tomcat and Apache HTTP are completely different server technologies. It is impossible to use a plugin for Apache HTTP server with Tomcat.
Apache HTTP server is developed in C and so are the plug-ins. On the contrary Tomcat is now completely developed in Java. Tomcat doesn't only serve static content, but it can also serve JSP pages and servlets.
Tomcat is used for hosting Java Web Applications. It can sure serve static content - you can host a web application using only Tomcat. Secure connections are supported and the performance is also very good (comparable with the performance of HTTP server).
A plain installation of Apache serves static content. Using the appropriate plug-ins, HTTP requests can be redirected to an application server (Tomcat, JBoss, Glassfish) or a script language interpreter (PHP). With this way dynamic content can be generated. The big advantages of Apache are the numerous plug-ins available, which allows administrators to configure and monitor web sites any way they want and that is the most widespread server available. This makes it the most secure solution, since it is thoroughly tested and any discovered flaw is corrected very quickly.
The best solution would be to use Tomcat proxied by an Apache server. It isn't so difficult to set up. If you can't do this, then you can't take advantage of Apache's plug-ins.
You see this confusion all the time. Many people think that Apache is a web server where in reality it is the name of an organization that has a web server project called "The Apache HTTP Server Project". In short the web server is called HTTPD (D as in daemon or Unix process).
Tomcat is another Apache project. This project implements a Java servlet engine to serve JSP pages and servlets. Tomcat and HTTPD have nothing to do with each other. However, you can set up HTTPD and Tomcat so that they work together. This way you can have HTTPD serve all static content, do URL rewriting and much more fancy stuff that the built in Tomcat web server can't do (or can't do very well). Whenever a JSP page is requested, HTTPD will pass the request on to Tomcat. Tomcat will process the request and will hand the output back to HTTPD which in turn will send it to the client.
Apache has many interesting projects. E.g. there is also a project called Geronimo which is a Java Enterprise server (J2EE). You can e.g. choose to embed Tomcat inside Geronimo to handle requests for JSP's and servlets where Geronimo does the more enterprisy stuff (LDAP, Messaging etc.). And you guessed it probably already, you can use HTTPD as a static content server for Geronimo as well.
totally bogus. Apache httpd plugins are written in C, Tomcat is pure Java.
Tomcat is a Java servlet engine. It can be hosted under Apache or IIS or quite a number of other external facing web servers. It sounds like you may be currently running your Tomcat instance standalone...
If you serve the JSP/servlets off of port 8080 and have it do things standalone, on the same host machine that Apache is running on, this can allow you to have them loosely coupled. Having multiple web servers fielding independent requests is not recommended, especially if you want to use server-based authentication along with Apache. Typically, you have one outside facing server that shepherds everything through it... Apache does this quite well, and the plugin you mention probably relies on this type of setup (everything gets wired through Apache) for its features/capabilities, based on your brief description of it.
If you would like to serve up your Tomcat servlets under Apache, you could configure apache to forward a class of URIs to your tomcat server instances. you could achieve this type of forwarding through mod_rewrite. this is a slower option performance-wise, as it adds slight overhead on everything you server up. You could also proxy incoming requests via a CGI mechanism similarly, from Apache to Tomcat.
mod_jk will simplify deployment and increase performance for placing Tomcat into an Apache server config. It is pretty painless to configure if you follow the docs, so I am not sure what you mean by "too complex" for your deployment -- if you want Apache and have Tomcat already, it would seem only a matter of slight config changes to get mod_jk downloaded and installed.

Difference between the Apache HTTP Server and Apache Tomcat? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
What is the difference in terms of functionality between the Apache HTTP Server and Apache Tomcat?
I know that Tomcat is written in Java and the HTTP Server is in C, but other than that I do not really know how they are distinguished. Do they have different functionality?
Apache Tomcat is used to deploy your Java Servlets and JSPs. So in your Java project you can build your WAR (short for Web ARchive) file, and just drop it in the deploy directory in Tomcat.
So basically Apache is an HTTP Server, serving HTTP. Tomcat is a Servlet and JSP Server serving Java technologies.
Tomcat includes Catalina, which is a servlet container. A servlet, at the end, is a Java class. JSP files (which are similar to PHP, and older ASP files) are generated into Java code (HttpServlet), which is then compiled to .class files by the server and executed by the Java virtual machine.
In addition to the fine answers above, I think it should be said that Tomcat has it's own HTTP server built into it, and is fully functional at serving static content too. Depending on your java virtual machine configuration it can actually outperform going through traditional connectors in apache such as mod_proxy and mod_jk.
That said a fully optimized Tomcat server should serve static files fast and if you have Java servlets, JSPs and ColdFusion files in addition to static content you may find tomcat does an excellent job by itself.
Apache is a general-purpose http server, which supports a number of advanced options that Tomcat doesn't.
Although Tomcat can be used as a general purpose http server, you can also set up Apache and Tomcat to work together with Apache serving static content and forwarding the requests for dynamic content to Tomcat.
Tomcat is primarily an application server, which serves requests to custom-built Java servlets or JSP files on your server. It is usually used in conjunction with the Apache HTTP server (at least in my experience). Use it to manually process incoming requests.
The HTTP server, by itself, is best for serving up static content... html files, images, etc.
an apache server is an http server which can serve any simple http requests, where tomcat server is actually a servlet container which can serve java servlet requests.
Web server [apache] process web client (web browsers) requests and forwards it to servlet container [tomcat] and container process the requests and sends response which gets forwarded by web server to the web client [browser].
Also you can check this link for more clarification:-
https://sites.google.com/site/sureshdevang/servlet-architecture
Also check this answer for further researching :-
https://softwareengineering.stackexchange.com/a/221092
If you are using java technology(Servlet/JSP) for making web application you will probably use Apache Tomcat.
However, if you are using other technologies like Perl, PHP or ruby, its better(easier) to use Apache HTTP Server.
Well, Apache is HTTP webserver, where as Tomcat is also webserver for Servlets and JSP.
Moreover Apache is preferred over Apache Tomcat in real time
Apache is an HTTP web server which serve as HTTP.
Apache Tomcat is a java servlet container. It features same as web server but is customized to execute java servlet and JSP pages.