RSS

Daily Archives: January 5, 2012

Enable tomcat support for a temporary URL

It is possible to enable temporary URL for tomcat enabled site.The answer for this is YES

If you want to enable tomcat for temporary/testing URL Just Follow below steps :

1) Login to the server as root

2) Open the server.xml file.

[ root@server~]# vi /usr/local/jakarata/tomcat/conf/server.xml

3) Insert following code to virtual host entry below the Alias tag.

<Host name="test.com" appBase="/usr/local/apache/htdocs">  <Alias>www.test.com</Alias> ---->> Add the following code <Listener className="org.apache.catalina.startup.UserConfig" directoryName="public_html" homeBase="/home" userClass="org.apache.catalina.startup.HomesUserDatabase"/> ---->>  docBase="/usr/local/apache/htdocs" debug="1"/>  <Context path="/manager" debug="0" privileged="true"  docBase="/usr/local/jakarta/tomcat/server/webapps/manager">  </Context>  </Host>

Save and quit.

4) Now open the apache configuration file and locate the entry for the respective domain name. Add the respective code depending on apache version to the file

[root@server~]# vi /etc/httpd/conf/httpd.conf

The  configuration will be somewhat similar as follows:

<VirtualHost serversIP:80>

ServerName yourdomain.com

DocumentRoot /usr/local/apache/htdocs

ServerAdmin test@yourdomain.com

<IfModule mod_suphp.c>

suPHP_UserGroup nobody nobody

</IfModule >

——->> Considering apache version is 1 insert the following line.

Include “/usr/local/apache/conf/userdata/std/1/nobody/hostname/*.conf”

——–>>

</VirtualHost>

Similar code to be added for the https virtualhost entry.

<VirtualHost serversIP:443>

ServerName  yourdomain.com

DocumentRoot /usr/local/apache/htdocs

ServerAdmin test@yourdomain.com

<IfModule mod_suphp.c>

suPHP_UserGroup nobody nobody

</IfModule >

Include “/usr/local/apache/conf/userdata/std/1/nobody/hostname/*.conf”

</VirtualHost>

save and quit.

5) Create the directory /usr/local/apache/conf/userdata/std/1/nobody/yourdomain.com/

[root@server~]#  mkdir -p /usr/local/apache/conf/userdata/std/1/nobody/yourdomain.com/

6) Create a file  cp_jkmount.conf in the above path and insert following code in it.

[root@server~]# vi /usr/local/apache/conf/userdata/std/1/nobody/yourdomain.com/cp_jkmount.conf

<IfModule mod_jk.c>
JkMount /*.jsp ajp13
JkMount /servlet/* ajp13
JkMount /servlets/* ajp13
JkMount /*.* ajp13
JkMount /* ajp13
JkMount /*.jspx ajp13
</IfModule>

Save and Quit.

7) Now restart the tomcat and apache service.

8 ) Now Try Accessing http://yourdomain.com/~username

Advertisements
 
Leave a comment

Posted by on January 5, 2012 in Uncategorized