Apache 2.4.6 and Apache Tomcat 7.0.42 on Port 80

On my Ubuntu 13.10 I have installed Apache and Tomcat. I am trying to get tomcat to work on port 80 with no luck at all. I have looked at using mod_jk following several online tutorials with no success. What I am trying to achieve is I have a webapp on tomcat running as the root application. Therefore the current url is www.example.com:8080. I also have apache which is on the url www.example.com. I want to be able to access files on the apache webserver for e.g www.example.com/somefile but also have my webapp running at the sametime on www.example.com. Please can anyone help.

Answers


You need to add url redirection to apache and check for the path in apache httpd.conf.

Check the path of the incoming request is just example.com then you rewrite it to example.com:8080.

The mod_proxy of apache should be able to do this for you.

http://tomcat.apache.org/tomcat-4.1-doc/proxy-howto.html


Apache Tomcat by default runs on port 8080. Incase if you need to run it in port 80 you need to use JSVC which comes along with tomcat. If you have installed tomcat by downloading the binary version then jsvc will be available under

[tomcat_install_path]/bin/commons-daemon-native.tar.gz 

you need to untar it and compile it. Compiling it is easy.

# ./configure
# make

once you have compiled it you will get the jsvc binary file which needs to be placed under the tomcat bin directory.

Then to start up tomcat with the help of jsvc follow the steps mentioned here

JSVC is the officially recommended way of starting Tomcat in port 80.


So I managed to solve this problem by Using Mod_Proxy. Editing the 000-Deafult.conf file in /etc/apache2/sites-enabled and adding the following lines:

ProxyPass /SomeUrl !
ProxyPass / http://localhost:8080/

The first line indicates what you don't want to proxy and the second one indicates what to proxy.In this case forward the ROOT app of Tomcat at port 8080 to the root of the Apache web server

Also edited the server.xml file in /etc/tomcat7 and added the following

<Connector port="8080" protocol="AJP/1.3" proxyName="www.mydomain.com" proxyPort="80"/>

Need Your Help

Android- How to drag a picture on a canvas

java android android-canvas draw

I need to drag an image like in a videogame. I have a few lines drawed and I need to drag it and see the lines drawed before "out" of the window. I give you two images trying to help to understand ...

Reporting errors from the application services layer

spring-mvc error-handling domain-driven-design

I'm implementing web application based on Spring MVC and organized around DDD concepts. Currently I try to implement ticket reservation functionality. The customer can see number of tickets availab...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.