How to run multiple sites on tomcat and/or apache

I am running tomacat. I have one registered domain. I gave my dynamic ip of computer (having tomcat) in dns and now my website is running.
www.firstwebsite.com 
I had done this by adding index.html page in Root directory of tomcat which is home page of my website 'firstwebsite'

Now if I want to run an other website www.secondwebsite.com on same computer, how i would do that.
I have to give same ip in dns setting of my second website. but my compter should know some how that it is comming from www.firstwebsite.com or www.secondwebsite.com
Is it possible?

Also If i want to run Apache on differnt port like 8989 beside tomcat, can I give that port in my dns entry?
like 192.168.1.44:8989 .... some thing like that?

I am running windows xp and tomcat 5.5 on port 80.
Later may be I would like to add apache but on diffrerent port then 80.



Thanks.
mithu11Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Brad HoweDevOps ManagerCommented:
Hi,

What you are looking for is VIRTUAL HOSTS and the LISTEN option which are both in the httpd.conf file.

CHANGE APACHE PORT
1. Open httpd.conf file in your text editor.
2. Find this line:   Listen 80   change it to:    Listen 8080 or whatever you want
3. Save and restart Apache.
    *Always restart Apache after making changes to a conf file and don't foget to make a backup before making any
      edits.
4.  http://locahost:8080 would now be your apache port. You must always add :8080 to the url now.

VIRTUAL HOSTS
I have striped parts of this out to help show you what you need to do. Taken this from here (http://www.debian-administration.org/articles/412) but the config is relatively the same.

1. Create the directory structures. This is just for example purposes
   mkdir /home/www

   mkdir /home/www/www.example.com
   mkdir /home/www/www.example.com/htdocs
   mkdir /home/www/www.example.com/logs

   mkdir /home/www/www.example.net
   mkdir /home/www/www.example.net/htdocs
   mkdir /home/www/www.example.net/logs

   mkdir /home/www/www.example.org
   mkdir /home/www/www.example.org/htdocs
   mkdir /home/www/www.example.org/logs

      or c:\your\web\folders.

2. httpd.conf configuration

 NameVirtualHost *

#
#  Example.com (/etc/apache2/sites-available/www.example.com)
#
<VirtualHost *>
        ServerAdmin webmaster@example.com
        ServerName  www.example.com
        ServerAlias example.com

        # Indexes + Directory Root.
        DirectoryIndex index.html
        DocumentRoot /home/www/www.example.com/htdocs/

        # Logfiles
        ErrorLog  /home/www/www.example.com/logs/error.log
        CustomLog /home/www/www.example.com/logs/access.log combined
</VirtualHost>

#
#  Example.net (/etc/apache2/sites-available/www.example.net)
#
<VirtualHost *>
        ServerAdmin webmaster@example.net
        ServerName  www.example.net
        ServerAlias example.net

        # Indexes + Directory Root.
        DirectoryIndex index.html
        DocumentRoot /home/www/www.example.net/htdocs/

        # Logfiles
        ErrorLog  /home/www/www.example.net/logs/error.log
        CustomLog /home/www/www.example.net/logs/access.log combined
</VirtualHost>


#
#  Example.org (/etc/apache2/sites-available/www.example.org)
#
<VirtualHost *>
        ServerAdmin webmaster@example.org
        ServerName  www.example.org
        ServerAlias example.org

        # Indexes + Directory Root.
        DirectoryIndex index.html
        DocumentRoot /home/www/www.example.org/htdocs/

        # Logfiles
        ErrorLog  /home/www/www.example.org/logs/error.log
        CustomLog /home/www/www.example.org/logs/access.log combined
</VirtualHost>

Hope it helps get you going.

Cheers,
Hades6666

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Networking

From novice to tech pro — start learning today.