mod_proxy with apache tomcat, how do I set it up? - apache

I have my app that serves on localhost:8080. I want to configure things so that it just servers on localhost:80 (or localhost without the port specified). I was told to follow these instructions.
My apache-tomcat that I downloaded is located at /home/myusername/tools/appname/apache-tomcat-6.0.33
I can't find an httpd.conf file in that dir... so I can't make the changes that the above article mentions. I am not sure what to do. I am new to apache/tomcat. Any help would be great!

Those instructions are for apache, which is different from apache's tomcat. What you have (the 6.0.33 thing) is apache's tomcat, which hosts/runs webapps but isn't typically used as a general webserver. You need to download and install apache, then you'll be able to follow those instructions.
You can download the apache webserver here: http://httpd.apache.org/download.cgi
Or if you are using an OS with a package manager, use your OS'es package manager instead.
Typically, the httpd.conf file should be at /etc/apache2/httpd.conf (or /etc/apache/httpd.conf).

Related

Apache Server - Change port from 8080 to 80

I have recently bought Amazon EC2 server.
Instead of installing it trough command line, I downloaded the latest zip file and deployed my application in WebApps folder.
The problem is tomcat is listening all the requests on port 8080 instead of 80.
I have tried changing the server.xml file in conf folder but no help!!
It is still listening to port 8080.
How do I make it listen to port 80
Oddly enough, Tomcat has its own documentation about doing this:
http://wiki.apache.org/tomcat/HowTo#How_to_run_Tomcat_without_root_privileges.3F
Probably the most straightforward way on *NIX is to use jsvc which is a small utility that works by binding to a port, dropping privileges, and then launching Tomcat, which can then use lower-numbered ports.
There are a bunch of other ways, but jsvc is the easiest and offers some other benefits as well. Discovering those benefits is left as an exercise for the reader.
The following would apply toward various systems, while the second link would related toward windows based systems.
First link :http://www.klawitter.de/tomcat80.html
Second link:
http://javarevisited.blogspot.com/2011/12/how-to-change-tomcat-default-port-8080.html?m=1
Ok. So finally I figured out way to solve this problem.
First of all i was doing it wrong way. One should not open port 80 for tomcat7. Tomcat7 should always run port 8080 or anything which is greater than 1024.
So to make your web site work without port. Follow below steps.
Install Apache2. (By default it runs on port 80).
Go to localhost and make sure apache2 is installed properly.
Then you will have to redirect all the requests which are going on port to redirect to port 8080.
To do that follow below link. (this is important step)
https://www.digitalocean.com/community/tutorials/how-to-use-apache-http-server-as-reverse-proxy-using-mod_proxy-extension
Hope this answer helps!!!
Thanks
Fahad Mullaji
I wouldn't recommend doing that, for what it is worth...
That could work in theory, but you are literally using httpd as a proxy to forward every request. There isn't much of a reason, IMHO, to choose this over simply changing the port to 80 in the Tomcat configuration and ditching httpd. You can use port 80 for Tomcat but historically, in production environments, httpd is generally used to serve static assets and such and dynamic content would be served by Tomcat. Generally one would install mod_jk and use the jkMount directive to connect Tomcat to httpd via AJP, which is a lot faster being a binary protocol than using HTTP.
There used to be a much bigger difference in terms of performance, here.
Tomcat is able to serve static resources via its DefaultServlet pretty well these days.
For AJP setup, see the documentation here:
https://tomcat.apache.org/tomcat-4.0-doc/config/ajp.html

Is is possible to have a dynamic configuration for mod_proxy to connect Apache httpd to Tomcat?

I have an Apache httpd and a Tomcat server connected together using mod_proxy.
I need to add both a ProxyPass and ProxyPassReverse to my httpd.conf and vhost.conf for each of my REST-style functions to configure the reverse proxy.
Is there any possibility to configure these dynamically?
You can't really dynamically-configure mod_proxy, nor would you want to do so, because you want the configuration to stay on the disk so you can reload it, survive server restarts, etc.
What you could do is include a separate file (or whole directory) each of which contains the configuration for a single function. You could have your build process auto-generate the configuration file(s) for all your functions. Just place those files in the right places and reload Apache httpd.

Nginx, Apache and Plesk

I am currently trying to take some load of my Apache web server.
The idea is to let nginx handle the static files.
The procedure is simple nginx pass-> 8080 to Apache.
There is just one problem.
The server has Plesk installed, and Plesk handles the vhosts with the .include files in every vhost folder/config.
Every vhost has an different port and setup in his own .include file, and that makes it impossible to change the Apache port to 8080 on a global level.
Any ideas?
As mentioned, it's better to use latest plesk 11, because it has native nginx support and it's actually stable now.
Since Plesk 9.5 appears ability to change apache ports through /usr/local/psa/admin/bin/websrvmng check for --set-http-port and --get-http-port in this pdf
Since Plesk 10.2 there is ability to change apache port on global level through plesk database http://kb.parallels.com/11232

Apache2 SSL configuration in several files?

I have setup Apache2 with SSL on a Debian Linux (squeeze) box. In the /etc/apache2/sites-available/default-ssl the SSL Engine is already configured and working. Packages with web software often come with an extra pkg-apache.conf file with some virtualhost, alias and directory directives. How could I make such package available via https without putting the content of pkg-apache.conf into default-ssl? Adapting the to *:433 results in load errors.
You can use the Include directive within your SSL virtual host to point to your extra configuration file. You'll need to make sure that the directives within that extra file can be used within a VirtualHost section.

setting up mod_jk on the Apache HTTP web server2.2.13

So I'm trying out JSP for the first time. I found a tutorial that details the installation of the tomcat server and the mod_jk Apache module, but it's a bit outdated. Right now, I've got everything installed and the mod_jk.so file in the modules folder, along with the corresponding loadModule line in the httpd.conf file. The tutorial tells me to copy a file called 'workers.propperties' to the apache conf directory and do some changes inside it, but there's no such file in the win32 binary installation. However, there is a file in the zipped source code, but I'm not sure if I should use it.
I have installed JDK1.6.0U17/JRE6.0/Apache HTTPServer2.2.13/Tomcat6.0.20/Mod_JK1.2.28/Vista
First this question: do you actually need Apache HTTP Server for other purposes? If not, just leave it aside and run Tomcat standlone. I've namely seen too often that starters are somehow under the impression that they need both Apache HTTP Server and Apache Tomcat to be able to run JSP's. This is untrue. Just Tomcat is enough. It's a webserver and servlet container in one.