Apache TomCat as web server and container - apache

I have Apache tomcat 7 where I build my web application and I also have Apache Web Server where my web site exist wrote on Css and HTML. I want to inject my web app on web site. How can I make my Tomcat as web server and container and transfer web site from Apache WebServer to Tomcat. ???
I know tomcat also can work on 80 port. Just I use to read documentation how to integrate Apache WebServer with Tomcat using mod_jk ajp connectors and etc to do, seems like it doesn't work.

If you want to use Tomcat as your web server (to serve your .html and .css files and probably images), then you can just get rid of the Apache Web Server; you no longer need it, according to your question. Then, after putting all your html/css/etc. under webapps/[app-root]/, make sure that all references to port 8080 in Tomcat's conf/server.xml are changed to port 80, reboot Tomcat, and you'll be good to go.

Related

Running two copies of Apache web server on same server for two different applications

I've created another instance of Tomcat(port: 81) to run a different application in a server. Tomcat is running successfully but I want to run apache web server on top of it. So, I copied existing apache in another folder and configured to the another instance of tomcat. I'm facing below error. Your help will be greatly appreciated.
enter image description here
It would appear that both instances are configured to also listen for https connections on the default port (443), i.e. while you may have configured them to listen on different http ports (i.e. 80 and 81), you haven't done the same for https.
First, something else is already using that 443 port, so try 8443.
Also, technically, you can install Tomcat twice using different service names, but why. The beauty of Tomcat is using one installation for multiple applications.
Tomcat is intended to support multiple apps. With a .war file you simply upload your .war file to web apps folder. Tomcat will automatically extract the war file.
To run app as ROOT application, delete the ROOT folder in Tomcat. Rename the .war file for the app you want to install to ROOT.war, it will extract to ROOT folder and you will access it from http://servername:8080, if you kept the default settings of the tomcat connector.
Now, to add a second application, copy a .war file to Tomcat webapps folder, with a different name other than ROOT.war, such as example.war. It will automatically extract the .war file into an example folder. To access that application, go to http://servername:8080/example. You will not have two Tomcat connectors for port 8080, just the 1, and you will access non-ROOT webapps via a context path.
Option 1:
If you want to use TLS in Tomcat, you need to uncomment the 8443 connector in Server.xml. You also need to create a keystore, and put in that keystore information in Server.xml to allow TLS.
Option 2(Doesn’t work with option 1, unless you pick a different port):
If you want a web server with TLS, then set Apache Web Server to listen on 8443, which will also require creating a key store and virtual host file in Apache Tomcat, but leave the Tomcat port at 8080 as it normally would be. Then use virtual host settings on Apache Web Server to proxy to the Tomcat apps (jumping from 8443 to the 8080 ports on the same host with Tomcat only listening on 127.0.0.1 or different hosts with proper network separation so people can’t get around the Web Server). Apache2 would be listening at the Web
Server FQDN.
Example:
Skip the Apache Web Server, and use different context path settings (as needed) for each tomcat application on the single 8443 port. (Make sure Apache2 is no longer using 8443).
ROOT app:
User—>https://servername:8443
App2:
User—>https://servername:8443/app2
Using Apache Web Server, you would proxy from port 8443 to 8080. Apache Web Server listening on 8443, Tomcat listening on 8080. TLS encryption would be at the Web Server. The connection between the Apache2 and Tomcat would be unencrypted on the same server.
This is a pretty thorough example of reverse proxy:
https://www.digitalocean.com/community/tutorials/how-to-use-apache-http-server-as-reverse-proxy-using-mod_proxy-extension
User—>https://servername:8443–>http://localhost:8080

websphere and apache server proxy and rewrite configuration

There are javaEE applications run on WebSphere server.
The thing I wanna do that to configure a http server that takes the request and redirect to my local websphere server.
For example:
This is live Project testProject.com/Otel..
I wanna reach my local project when I insert local.testProject.com/Otel..
The thing I have done so far I can reach my local apache server when I click local.testProject.com just with adding in host file in windows/system32/drivre/etc directory.
The thing I could not do so far. redirecting this incoming request to my apache server to websphere server.
Could you please help me on these. Dont hasitate to ask further questions.
I would be appreciated if you could give me some ideas with just commenting at least.
Good days..
IBM provides a specialty reverse proxy module for Apache called the WebSphere WebServer Plug-in. Its use is described in detail in the websphere documentation.
In simple configurations, you can just configure any server you already have as a reverse proxy.
Load mod_proxy and mod_proxy_http (varies depending on Apache distribution)
Append to your virtual host:
ProxyPreserveHost ON
ProxyPass /otel http://washostname.example.com/otel
# ProxyPassReverse likely not required in your case.
Of course there are thousands of places to read about setting up Apache as a reverse proxy and there are nearly no WebSphere specifics.

xampp Apache redirect to tomcat

Using Xampp on my Windows Server I recently installed some web apps using tomcat. Using the Apache to access phpMyAdmin. After deploying I noticed I access the tomcat webapp using a URL like this: domain.com:8080/someapp/.
I do not like that but the internet says its good for some security reasons so I did not change the port from 8080 to 80 in the server.xml.
But I want the end-user not to access my app using :8080 in the URL.
How can I redirect my Apache to Tomcat witgout losing my access to phpMyAdmin?

Tomcat through Apache

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.

Make tomcat redirect to another server with the same domain

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.