Link to home
Start Free TrialLog in
Avatar of yehiaeg
yehiaegFlag for Egypt

asked on

Tomcat WebApps Folder Structure

Hi,

Is there any reason a java application would use this folder structure on plesk,

/usr/share/tomcat5/psa-webapps/testexample.com/testexample/[files+classes]
instead of just
/usr/share/tomcat5/psa-webapps/testexample.com/[file+classes]

is this a best practice i'm not aware of, quite frankly i'm maintaining a list of tomcat projects on a dedicated server and they all follow this same pattern and i want to understand if this has something to do with anything, as this requires additional handling in the htaccess and vconf:

RewriteEngine on
RewriteBase /testexample/
RewriteRule ^/?(.*\.jsp)$ /testexample/$1 [L]
RewriteRule ^/?(.*)$ /testexample/$1 [L]
===========================
DirectoryIndex index.jsp index.htm index.html index.php            
JkMount /testexample ajp13
JkMount /testexample/* ajp13
RewriteLog /etc/httpd/logs/rewrite.log
RewriteLogLevel 3
DocumentRoot /usr/share/tomcat5/psa-webapps/testexample.com/testexample
<Directory /usr/share/tomcat5/psa-webapps/testexample.com/testexample>
    Options Indexes FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

Thanks In Advance
Regards.
Yehia A.Salam
Avatar of Kevin Cross
Kevin Cross
Flag of United States of America image

Yehia:

My initial guess would be (given my experience with Plesk is with shared hosting environments) is that this was setup to have specific folder for each hosted account which should end up being its own virtual server.

In other words, the /testexample.com is only seen on the physical file system and isolates that domain from others hosted on this system, but when you open browser to DNS entry http://testexample.com/ you get the root of web server and don't need to do this: http://testexample.com/testexample.com/.  

Subsequently, for that domain, it is up to you whether or not you want the site to use the root or a folder specific to the site.  A number of folks will and so this isn't out of the ordinary: http://testexample.com/testexample.  

That way you can also host other sites like:
http://testexample.com/secureexample/
http://testexample.com/prodexample/

Without having to change much of code as each site will already know to look in one folder down from root and below and you can take advantage of having common items between the sites at the root like:

http://testexample.com/images/
http://testexample.com/bin/

etc.

Hopefully that makes sense and helps.

Best regards,

--isa
Avatar of yehiaeg

ASKER

actually i was thinking that maybe they were doing this to make the tomcat run only on the folder that contains the jsp files or the cms, and the root would contain any other html or php files (that if you were running a php engine on the side),

check the last paragraph on http://rimuhosting.com/knowledgebase/linux/java/tomcat%20on%20plesk

what do you think?
ASKER CERTIFIED SOLUTION
Avatar of Kevin Cross
Kevin Cross
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial