I'd like to know if is a good decision to configure tomcat through port 80 (in apache with virtual-hosts ).
I need to setup a tomcat service in the same server I have apache, plus I need to use Tomcat through port 80.
Is this right? or is best to use them in separated servers?
That's OK. But sometimes tomcat is deployed with Apache. The Apache is a front-end server to balance load. And many tomcats are as back-end servers.
Related
I am using tomcat on Linux centOs server. I want my java application is working fine on mydomain.com:8080. I want that my when some one hit the domain mydomain.com it automatically move to my java application.
Changin server.xml didm't worked for me. as i am also having apache2 on the server
I guess you have an apache server in port 80. I you do not want to remove apache and change directly the tomcat port ( see comments), you will need to redirect all traffic from port 80 to port 8080.
This can be done using tomcat connectors. They are plugins to connect web servers with Tomcat. When a HTTP request arrives, the plugin checks is it has to be redirected, connects to tomcat and returns the response to server
In the case of apache is needed to install mod_jk. In the link you can see the configuration
I have a domain name and a tomcat server so when I deploy an application on it, this is accesible via my.domain.com/MyApp and everything is fine.
The problem is that I have some applications I can't deploy on my tomcat server and i think i'll have to make another tomcat server to deploy them and when I type my.domain.com/MyNEWApp I want to be redirected to the new server but i don't know how to do it or if there is a better solution for my problem.
Place your Tomcats behind a content-switching load balancer or a reverse proxy (e.g. Apache with mod_proxy, mod_jk or mod_cluster) and point the my.domain.com domain to the LB. Then on the LB, route traffic to respective Tomcats based on the context root.
JBoss Enterprise Application Platform 6.1 on Linux Enterprise Redhat
I have seen several examples on how to have Apache forward requests to JBoss. I am looking to have a JBoss server listening on port 80 forward cgi calls to an Apache server. Can JBoss be configured to listen at port 80 and forward all requests containing "cgi-bin" to port 8080 where Apache server is listening?
The need to do this arises from
Jboss not supporting cgi (mod_perl in my case) AFAIK
Since i am migrating from a server where all web requests used port 80, needing to keep the port as 80 to avoid programming changes
99% server calls are handled by JBoss, so i want it to be the primary point of contact
Despite JBoss handling the 99% of calls, the better architecture is to have Apache in front of JBoss.
You would have Apache serve port 80 and forward to JBoss via mod_cluster or mod_jk. This will allow you to control your content via Apache. You should serve your static content directly from Apache as well.
Additionally with this architecture, you can cluster your environment and load balance across multiple servers. This gives you higher fault tolerance (session replication, failover), handle more load, and helps you avoid server outages.
mod_cluster is recommended for EAP 6, but mod_jk works just fine too.
We want to front-end our Tomcat instance with an Apache instance (running on the same machine) that will be serving everything on HTTPS and connect Apache to Tomcat using AJP. When using AJP, do we need to do anything to make sure that the connection between Apache and Tomcat is secure? (We dont want passwords to be sniffable on the network between Apache and Tomcat). The O/S is Red Hat Enterprise Linux 6.3
You are saying
Tomcat instance with an Apache instance (running on the same machine)
and later you are saying
We dont want passwords to be sniffable on the network between Apache and Tomcat
This just contradicts each other.
EDIT: AJP is not designed to be secure, if you need security, use mod_proxy_http and proxy over https, or create SSH tunnel. Needless to say, you will have to pay for this overhead.
When using AJP you cannot do anything to ensure it is secure. It isn't. There is no SSL version. You would have to use HTTPS. AJP is designed for the usual case where HTTPD and Tomcat are in the same private LAN and security isn't an issue.
Basically i want my tomcat to run on PORT 80 how do i do that because whenever i have to access something then i have to go for localhost:8080/resource but instead i want to use the link as only localhost/resource how do i achieve this?
Currently on my machine apache is running on 800 port and tomcat on 8080.
it seems you are looking for something called Reverse Proxy. Using Reverse Proxy, you will have
apache on 80 port
tomcat on 8080 port
so when access http://xxx.test.com/resource, the request first go though apache, apache then pass the request tomcat, tomcat do the corresponding things and return response to client.
have a look at:
http://www.apachetutor.org/admin/reverseproxies
mod_jk: http://tomcat.apache.org/download-connectors.cgi
Tomcat documentation has a HOWTO for this.
http://tomcat.apache.org/connectors-doc/webserver_howto/apache.html
Its a good practice to never expose Tomcat directly internet. You can use Apache for serving static content and send only those requests to tomcat that need dynamic content.
In server.xml find the element that reads
Connector port="8080"
and change it to 80. Save and restart tomcat.
Just make sure that apache is running on port 800 otherwise it will now clash with tomcat.
To modify the HTTP port for Tomcat, modify the configuration file server.xml (located in Tomcat's conf directory). Find the HTTP connector element (that is currently configured to port 8080), change the port number to 80, and restart Tomcat.
Note that this is not going to work if any other running service is currently bound on port 80.