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

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".

Related

Stopping traffic to unhealthy web server instance from loadbalancer

I have 3 web servers (Apache) which are behind vip (Apache, serving as a reverse proxy). We dont want LB to serve traffic if the anyone of web server which has 501 error.
How can I do that automatically.
PS: I am thinking is to use health checks as part of mod_proxy (under balancemember attribute).
I afraid you use wrong tool for LB. Apache can do that but it's not designed specially for that. My suggestion is to use HAProxy which is typical software for that situation.
If you need help with HAProxy just write. I could try to help but not ealier then on weekend.
ps. I created this account just to answer you :) I really know what I'm talking about. You want to use HAProxy instead of apache.

Protect home (webserver's) dynamic ip from reverse DNS issue

this is my first question here =)
I'm setting my webserver at home (trying both apache and nginx) and I've found that you can easily get and use free dynamic dns (sub) domain to make your server available not only with your home ip that would be changed next time after disconnect and connect to the internet. Actually I've made it working and it's great..
But the problem is that my personal unique data (account id/machine name) could be retrieved with reverse dns look up and I can not hide my real ip that is attached to server.
You can use proxy while browsing the internet, but how to proxy your web server (apache) that have free dyn dns (sub) domain?
I've already tried to create VirtualHost configurations, also with the use of proxy modules (mod_proxy, mod_proxy_http, mod_proxy_html) and additionally with proxifier tool, but no luck.
Some people say that it is possible to hide ip with nginx, but I never used to work with nginx. Still believe it is also possible with Apache, just can't figure it out.
I'm using private proxy in format [proxyip:port]. I must attach it everytime to my home ip to make it work. Maybe it's better to get login/password auth proxy, but at first I should find the way how to use it with web server.
Is there anyone who have luck with it? Can you explain, please, the proper config for apache? Currently I'm using version 2.4.
Many thanks and have a good day!

Is is mandatory to use httpd with tomcat?

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.

What would happen if I made a HTTP request to a server without Apache installed?

Doesn't have to be Apache, but that's just the only HTTP server I know of (Actually could you guys recommend alternatives that I could look into as well?)
Anyways, so I have been messing around with Amazon Web Services and I created an EC2 server instance with an Amazon Linux Image. On that, (Following guides and examples) I installed Apache and now when I make a GET request to my public IP, it returns to me the HTML files I created on my server.
My question is, what if I never installed Apache, and then made an HTTP request to my public IP? For no reason really, the question just came up in my head and I'm curious. I'd rather not figure out how to uninstall Apache or create a new instance to figure it out, so I was wondering if somebody could weigh in as well as tell me a little more about what it is exactly apache does on a server. My understanding is that it is a layer you can install on your server OS that will create a socket listener to port 80 (HTTP), and when a request is made on that port, Apache will return web pages? Also I think I read somewhere you could configure Apache to forward a port to something like a python server script?
Thanks in advance for your time!
could you guys recommend alternatives that I could look into as well?)
nginx is a popular alternative to apache. It's much more efficient.
what if I never installed Apache, and then made an HTTP request to my public IP?
Your browser would get a "connection reset" because there is nothing on port 80. Your browser would display a message (Chrome says "This webpage is not available"). You would NOT get a "404" because that requires an HTTP server to send HTTP codes.
If your server was firewalled instead, you'd bet a busy wait for a while, then a message about the server not responding.
Also I think I read somewhere you could configure Apache to forward a port to something like a python server script?
Yes, that is called "reverse proxy" mode. It's essential to any application website if you want to scale. The web server(s) can distribute traffic to one or more backends running the application. The web server is useful for filtering bad requests (since your backend in Ruby/Python will be 1000's of times slower than the reverse proxy.)
Well, if you want to test what will happen if Apache isn't installed, you can always just stop the Apache service by typing:
sudo service apache2 stop
or
sudo service httpd stop
depending on your version. Then if you visit your site's webpage you'll get a 404 error or something similar.
There are ways to use python scripts to run simple servers, but in general it's easier to just let Apache handle that and use a framework like Ruby on Rails or Django to control the display and creation of content for your server.

Redirecting web traffic in a server hosting both an Apache and a Glassfish web

I am hosting two web pages in my server. One is running on Apache and the another one on Glassfish. By now I solve the redirection problem making the Glassfish server to listen on a port distinct than the 80. The problem is that I think my web users have a firewall blocking those ports so they canĀ“t access the GlassFish web. Which way would you recommend me to take in order to make a URL request-based redirection? I want to make the glassfish web a subdomain of the Apache one, being both running at the same IP.
If I have not been sufficiently clear with my question, please let me know
Thank you for your time.
Have you tried modifying the domain or using subdomains? If one application is eg. at http://subdomain1.yourdomain.net and another at http://subdomain2.yourdomain.net it should do the trick without any problems. Or try http://yourdomain.net for your main program and http://yourdomain.net/somecontext for sub program. That looks meaningful also for the service user.
Tick the answer if you got help :)