Google-sovellukset
Päävalikko

Post a Comment On: lo-fi

"Apache, Tomcat, and mod_jk"

3 Comments -

1 – 3 of 3
Anonymous Anonymous said...

Seems like all these tutorials are flawed in one way or another. I have a site called www.mysite.com. When I hit that site, I want it to forward on the Tomcat folder and render it. I don't want to type in localhost anywhere. I want the DNS to resolve my name to my Apache installation and hit the Tomcat app. This does not do that. I am sure you know how to do it but if you could provide more insight on this, we would all be better off. Thank you.

8/19/2007 7:05 PM

Blogger Eric said...

If I understand your problem correctly, typing in your site in the url doesn't work because of 2 elements. DNS resolution and virtualhost configuration of your Apache and Tomcat servers.

The easiest way to simulate proper dns resolution is to edit your hosts file so the domain name points to the proper ip address (/etc/hosts in *nix, C:\WINDOWS\System32\drivers\hosts in Windows). There should be proper examples in those files

You'll also need to get your virtualhost configuration set up correctly. Tomcat has a server.xml file, which you can edit by adding a host entry. It will look something like this:

<Host name="www.domain.com"
appBase="webapps/myApp"
unpackWARs="true"
autoDeploy="true"
xmlValidation="false"
>
<Alias>domain.com</Alias>
<Context path="" docBase="" debug="0" />
<Logger className="org.apache.catalina.logger.FileLogger"
directory="logs" prefix="domain_log." suffix=".txt"
timestamp="true"/>
</Host>

Finally, you should make sure your Apache virtualhost is configured correctly. I don't have one handy, but some searching should help you. It's a simple thing to do, and quite common.

8/20/2007 11:11 AM

Anonymous Anonymous said...

That's my comment below. I didn't expect a reply otherwise I'd have been more specific. :-) I already have an Apache installation and a web site set up. I only used www.mysite.com as a example.

Right now, when I type in www.mysite.com in the url address bar out on the internet, I can get static pages off of my c:/vhosts folder. Works great.

Now, I want to add dynamic content. I already have a webapp written that works great on localhost under Tomcat. I type in http://localhost:8080/mysite and it pops up my index.jsp page for mysite webapp. Great!

Problem for me is hooking up the two together. So when I type in www.mysite.com, I want the index.jsp page served by the webapp. Simple enough request. The documentation on Apache and other places is outdated. I have Tomcat 6, Apache 2.2.

Right now, I have downloaded mod_jk into the modules folder. I read about workers.properties and so on but am not sure what I need to do next. In other words, I need to create a workers.properties file and modify httpd.conf file. Is that all I need to do? What mods do I make to these files? Thanks in advance.

8/20/2007 5:01 PM

You can use some HTML tags, such as <b>, <i>, <a>

Comment moderation has been enabled. All comments must be approved by the blog author.

You will be asked to sign in after submitting your comment.
Please prove you're not a robot