Question:

How could I change the default page that loads when you access the tomcat server page (i.e. localhost)?

by  |  earlier

0 LIKES UnLike

i want to change the page that appears when you access tomcat localhost (i.e. http://localhost:8080/)

i know this can be done by changing the index.jsp file in the ROOT folder (webapps/ROOT/index.jsp) but I want to keep this file as it is and load a jsp file in a different location of the webapps folder instead..

is this possible? how do i do it?

 Tags:

   Report

1 ANSWERS


  1. Well, this is really a web server issue, not a tomcat one.  Since you didn't say what web server you have tomcat installed on I can't help much but you basically just change the webservers root directory or point the root to a different subdirectory.  If you are running apache, just change the "--htdocsdir=DIR" to point to where you want the files to execute from on any http call.  Same is true in IIS or other webserver.

    With Apache you can even use the .htaccess file to point or redirect from the root.  

    Hope that helps - Tomcat is not the server its just the JavaServerPages overlay

    ADD: Actually, you are hosting something - your own site!

    http://localhost  is a web server.

    Since you are running apache, you need to edit the httpd.conf file. This is a TEXT file. This file is the controller for all apache items and is the file that sets what directory is accessed when you call http://localhost:8080  by default you already know that directory is /webapps/Root  but if you change that in the httpd.cong it will be where ever you want it to be.  

    Make a new directory in your webapps folder call it whatever you like but for this I will call it   YourSite.

    Find the httpd file, in Red Hat it generally is in

    /etc/httpd/conf/httpd.conf

    make a copy for safety  cp httpd.conf  httpdbackup.conf

    Use a text editor like vi or whatever you like.

    Find the line in httpd.conf that looks like this

    DocumentRoot /webapps/Root/

    change it to this

    DocumentRoot /webapps/YourSite/

    That way when you call localhost  you will get the /YourSite directory instead of /Root

    Once you do that change, restart the webserver and you will go to the new directory.

    To restart the web server from a command line just type

    service httpd restart

    If you get an error, you did the entry wrong.

    Here is a guide to the httpd.conf file

    http://www.faqs.org/docs/securing/chap29...

Question Stats

Latest activity: earlier.
This question has 1 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.