We want to host an application developed in Eclipse with the use of jsp under tomcat7 server in Ubuntu.
Let's suppose you have already installed tomcat7 on Ubuntu 12.04. Then you'll have tomcat root directory under:
/var/lib/tomcat7/webapps/
Create you own application directory:
/var/lib/tomcat7/webapps/YourApplication
We'll assuse this directory path to be $APP_ROOT. You need to have the following directory structure:
$APP_ROOT/META-INF/MANIFEST.MF
$APP_ROOT/WEB-INF/classes - this is where your *.class files need to be stored.
$APP_ROOT/WEB-INF/lib - this is where you *.jar need to be stored.
$APP_ROOT/WEB-INF/web.xml
(class files need to be stored in folders which correspond to their package names)
Create a Web application (Servlet context)
----------------------------------------------
edit the file /etc/tomcat7/server.xml
and create a line:
<Engine [...]>
<Host [...]>
<Valve [...] />
<Context path="/YourApplication" docBase="YourApplication" debug="0" reloadable="true" />
</Host>
</Engine>
and restart the tomcat server.
Your application should be server under:
127.0.0.1/YourApplication
Tip:
---------
You can redirect to your application from the root domain by editing the index.html under:
/var/lib/tomcat7/webapps/ROOT/index.html
<html>
<head>
<title>Your Page Title</title>
<meta http-equiv="REFRESH" content="0;url=http://yourdomain.com/YourApplication"></HEAD>
<BODY> Optional page text here.</BODY>
</HTML>
Edit your /var/www/index.html page as well.
No comments:
Post a Comment
If you like this post, please leave a comment :)