开发者

Tomcat 6 configuration example for Ubuntu Linux?

开发者 https://www.devze.com 2022-12-22 18:17 出处:网络
I\'m very new to Tomcat and I\'m having some issues figuring out how to set it up.I set it up on Ubuntu Linux and started reading and trying to follow the information given on the apache website here:

I'm very new to Tomcat and I'm having some issues figuring out how to set it up. I set it up on Ubuntu Linux and started reading and trying to follow the information given on the apache website here: http://tomcat.apache.org/tomcat-6.0-doc/deployer-howto.html

Apparently I'm missing something. I have a WAR named MyWebapp.war and it's in a directory /home/mywebapp. In /etc/tomcat6/Catalina/localhost/MyWebapp.xml, I have the following line:

<Context path="/MyWebapp" docBase="/home/mywebapp" antiResourceLocking="false" />

Everything else is the default configuration that came with tomcat6 via the Ubuntu package. When I restart Tomcat and try to go to http://localhost:8080/MyWebapp, I get a 404. The WAR file isn开发者_如何学C't unpacked and nothing seems to be working.

I'm going to be deploying two Grails applications on this server with Tomcat.

Is there a more straight forward way to do this?


I find the most straightforward way to deploy a .war to Tomcat is to use the Manager Webapp.

All you need to do is follow the instructions linked above. Setup a user in the default memory realm $CATALINA_BASE/conf/tomcat-users.xml. Navigate to http://myserver:8080/, log in with that user, deploy your app point-and-click style. Very handy, especially when you're getting started with Tomcat.

It also means you can deploy a war from your desktop, without having to manually copy it to the server.

Without using the manager webapp, you should be able to copy your war to $CATALINA_HOME/webapps and it should be automatically deployed for you. You shouldn't have to manually configure a Context for your app unless your app needs something like connection pooling resources setting up.


If you installed the packaged version, then the default webapp location is:

/var/lib/tomcat6/webapps

This location belongs to the tomcat6 user (you can use a symlink to your war if you want).

BTW, I don't know if what you're trying to do is possible but the current context configuration won't work. You're basically telling Tomcat that /home/mywebapp is a webapp (which is not the case), Tomcat will not look for a .war in there.

Actually, my recommendation would be to download a vanilla Tomcat archive, to unzip it somewhere in your home directory (I use ~/opt) to install it and.. that's all.

Then to start Tomcat, just run:

$ ~/opt/apache-tomcat-6.0.26/bin$ ./startup.sh 

To deploy a war, just copy it to:

~/opt/apache-tomcat-6.0.26/webapp
0

精彩评论

暂无评论...
验证码 换一张
取 消