[Home] [Credit Search] [Category Browser] [Staff Roll Call] | The LINUX.COM Article Archive |
Originally Published: Tuesday, 2 October 2001 | Author: Henry Chen |
Published to: enhance_articles_sysadmin/Sysadmin | Page: 5/6 - [Printable] |
Serving Java from Linux
Ever want a server on your box that can serve JSP and
Java Servlets but don't want to pay big money for a commercial solution? Then Linux.com has the article for you. Follow author Henry Chen into the land of the sun.
|
<< Page 5 of 6 >> | |
Testing and ConfigurationBefore we start modifying anything, we should first find out whether what we have done so far actually works. To test this, start the Apache web server: /etc/init.d/httpd start Then, open your browser and point it to The following will test whether you can specify where the Java related files are. Create a test JSP script with <% String vPath = request.getRequestURI(); String rPath = getServletConfig().getServletContext().getRealPath(vPath); %> <html> <head> <title> jsp test </title> </head> <body> <p>The virtual path is <%=vPath%></p> <p>The real path is <%=rPath%></p> </body> </html> The Apache web server already knows about <Host name="yourhostname"> <Context path="" docBase="/var/www/html" crossContext="false" debug="0" reloadable="true" > </Context> </Host> Then, restart Tomcat: /etc/init.d/tomcat restart To test if this works, point your browser to <VirtualHost IPAddress> ServerName hostname DocumentRoot directoryname </VirtualHost> Then, you also need to add Tomcat: <Host name="hostname"> <Context path="" docBase="directoryname" crossContext="false" debug="0" reloadable="true" > </Context> </Host> Since you add new information to the configuration files of both Apache and Tomcat, you will have to restart both.
| |
<< Page 5 of 6 >> |