Product:
Search Type:

[Info] How do I setup .JSP pages to run from domains' DocumentRoot directory.

Article ID: 1575 
Last Review: Jul,10 2008
APPLIES TO:
  • Plesk 8.x for Linux/Unix

RESOLUTION

Since the 8th version Plesk uses mod_jk Tomcat connector.


To be able to run .JSP pages directly from httpdocs/httpsdocs
directories you have to do some additional configuration. For example you
want to place your .JSP pages in the 'jsp' directory. You should create the 'jsp'
directory under httpdocs then create the vhost.conf file with the following
content:

# cat HTTPD_VHOSTS_D/DOMAIN_NAME/conf/vhost.conf
<IfModule mod_jk.c>
JkMount /jsp ajp13
JkMount /jsp/* ajp13
</IfModule>


then run websrvmng utility: "PRODUCT_ROOT_D/admin/sbin/websrvmng -v -a".

Then you should modify server.xml and create additional 'Context' inside appropriate <Host> tag. Host in Tomcat is the same as VirtaulHost in Apache configuration.

<!-- Here is part of the server.xml Host tag for "DOMAIN_NAME" domain: -->
<Host deployXML="true" name="DOMAIN_NAME" debug="0" appBase="psa-webapps/DOMAIN_NAME" unpackWARs="false"
autoDeploy="true" liveDeploy="true">

<!-- This is Context that is generated by Plesk: -->
<Context crossContext="false" reloadable="false" useNaming="true" debug="0" swallowOutput="false" privileged="true" displayName="Tomcat Manager Application" docBase="/var/tomcat4/server/webapps/manager" cookies="true" path="/manager" cachingAllowed="true"/>


<!-- This is Context that you should add to server.xml after the default Plesk Context: -->
<Context crossContext="false"
reloadable="false" useNaming="true" debug="0" swallowOutput="false"
privileged="true" displayName="Your Application Name"
docBase="/var/www/vhosts/DOMAIN_NAME/httpdocs/jsp" cookies="true"
path="/jsp" cachingAllowed="true"/>

<Realm
className="org.apache.catalina.realm.MemoryRealm" debug="0" pathname="psa-users/DOMAIN_NAME.xml" validate="true"/>
</Host>

Restart tomcat after server.xml modification.

Please note that you should replace DOMAIN_NAME with a real domain name.

Next, the user Tomcat is run under (usually it is tomcat) should be added into psaserv group in order to allow Tomcat to have access to a domain's httpdocs directory.

After that you can access your application by url like this: http://DOMAIN_NAME/jsp

Please provide feedback on this article

Did this article help you solve your issue?
Yes
No
Partially
I do not know yet
 
Strongly Agree   Strongly Disagree
  9 8 7 6 5 4 3 2 1
The article is easy to understand
The article is accurate
Additional Comments:
*Please provide us with your email address in case we need to contact you.
*Please type the code you can see.
* - required fields