Is is mandatory to use httpd with tomcat? - apache

Is is mandatory to use tomcat with httpd? Cant we just use tomcat directly avoid one more layer? We are running tomcat on port 80 and not using apache web server. Is this OK? Why typically httpd is used with tomcat?

This link "Why use Apache Web server in front of Tomcat" (it seems) explains your question very well.
In case I have misinterpreted the problem statement, let me know.

Related

Use Apache server behind proxy server

I have apache2.4 webserver installed on ubuntu 14.04, which has all the configuration for the virtual host file.Also I have configured ssl certificates in it. But I want to run this apache server behind other proxy server which have different IP then the Web Server.
Please suggest me the best way to do this.I am planing to install another apache on the proxy server and achieve this using reverse-proxy.But Please suggest any better way to do this.
Thanks
Vinay
I recently read some doc about setting up a reverse proxy server and it seems that ningx is a better choice than Apache for this task: it is very lightweight and really easy to configure. For example in a doc I read the writer could not manage to set up correct proxy for HTTPS for Apache, while another one trying the same configuration for nginx set it up easily. I am an old Apache fan, but if I had to install a proxy, I would chose nginx.

is setting tomcat application url to http:// hostname/application/ possible?

I have a setup, with tomcat running on port 8080 and apache webserver running on port 80.
So if I access http://localhost:8080/myapplication/ , it works.
But I need to be able to make it like : http://localhost/application/, but since my http web server runs on port 80, it seems that i need some re-direction logic or changes at the tomcat to achieve this.
Can anyone please suggest i way out. Thanks.
UPDATE:
Just found that there is already a solution provided here: How do I redirect from Apache to Tomcat?
You need to look at the Tomcat-Apache HOWTO.
It is entirely possible and in fact quite common for apache and tomcat to be used in combination by the tactics described in this page.
And this question really probably belongs on serverfault...
Since you mentioned about "users", I am guessing you are implying "hostname", when you mention "localhost". If you have a Load Balancer and a user friendly DNS name that you would give to the users, you can configure your Load Balancer software to route all requests to "hostnameyougavetotheUsers" to "yourinternalhostname:8080".

How to bind an ip AND ports to subdomains using JBoss (Or Apache Tomcat)

This is my problem:
I have a JBoss server (Running an existing app) and a Apache Tomcat (Running an app created by me) server running on the same server with different ports.
I have two subdomain names which i have routed to the IP of the server.
What i need to do is to bind the subdomain names to the IP, but with different ports.
I saw an easy way to do it with XAMPP and apache, editing the httpd.conf, but i can't find any simular fway to do it with Apache Tomcat or JBoss.
Does anyone have any ideas about this?
I rather have a solution on the question above, but the question below can be accepted as a backup solution:
Since i could not figure that out, i had to at least have a solution to one of the applications (the one running at JBoss).
So i configured JBoss to port 80 instead of 8080.
What happens now if i go to the subdomains is that i get the JBoss welcome window.
How can i change the default JBoss "app" to my app?
Thanks in advance
There's no way to get this:
sub1.domain.com(192.168.0.1) on port 80 --> jboss app
sub2.domain.com(192.168.0.1) on port 80 --> tomcat app
without either adding to or subtracting from your software stack.
Your options are:
use jboss to run your tomcat app
add a reverse-proxy
use an HTTP-aware layer 7 firewall
The first is probably easiest; jboss deploys web applications using tomcat (or, in more recent versions, a fork of tomcat called jbossweb), so you can probably just drop your .war into the deploy directory.
If that's not possible for some reason, I'd use a reverse-proxy. Apache HTTPD with mod_proxy or mod_jk is fairly common. If you go the mod_jk route and you have non-trivial load, I'd review this.
The last I'm not familiar with. I imagine that the spendy Cisco firewalls can do this, and I'm sure it's possible to hack iptables to do it too, but my google-fu failed to find specifics.

How do I get apache to forward web service requests to tomcat?

I know websphere does it, so there must be something that lets apache figure out what needs to go to the app server and what it can handle itself.
You have two options. You can use mod_jk or mod_proxy_ajp to forward your requests. I generally use mod_proxy_ajp because it is shipped with Apache 2.2 and doesn't require me to install anything extra.

Glassfish with Apache. Why SSL?

I have been looking around to figure out how to configure Glassfish front ended with Apache. And most of the tutorials using the load balancing plug in is making me enable SSL on Apache. I am trying to understand the connection. I should be able to do non SSL communications when I dont have a need for SSL.
There are several blog posts showing how you can use Apache in front of Glassfish. There are several options and depending on your needs, different strategies might be the most appropriate.
I've used Apache with mod_jk which forwards requests to Glassfish - both https and regular http. Lots of good references here.
It's possible to use other modules in Apache also like mod_proxy, but again the requirements you have will flesh out the most appropriate.
Glassfish also have pretty good http engine inside of it where you can configure virtual hosts like in apache. If the load on the Glassfish server isn't to big, you might consider just using Glassfish without anything in front of it.
You can also use the Sun Java System Web Server SJSWS instead of Apache. Despite it's atrocious name, it is just Sun's web server (free to use). It can be used as a reverse proxy (PDF). The SJWS/Glassfish combination is presumably tested really well by Sun.