Solved

Sharing port 80 between IIS and Tomcan server on the same machine

Posted on 2010-09-02
6
803 Views
Last Modified: 2012-08-14
hi, here is the situation:

we have two subdomains pointing to the same computer  (windows server 2008) and we are running IIS as webserver on one domain and Tomcat as webserver on another domain.  this is what we have now:

domain1.mycompany.com , ip 1.2.3.4 , IIS on port 80
domain2.mycompany.com , ip 1.2.3.4 , Tomcat on port 81

But it has become necessary to run both of them on port 80 and do routing based on the request (i guess by looking at the domain) .

How can i set this up in IIS and Tomcat? can anyone help ?

How can i
0
Comment
Question by:Softverkpro
6 Comments
 
LVL 20

Expert Comment

by:woolnoir
ID: 33585028
Its not possible (AFAIK) to have two services running on the same port/same IP in this way. Have you not considered adding another IP address to the NIC of the machine, and pointing each of the domains to separate IP's. That way you can have tomcat bound to 1.2.3.4:80 and iis bound to 1.2.3.5:80..

I know its not what you asked, but what scenario would you need two webservers on the same IP /port?
0
 
LVL 5

Expert Comment

by:helpnet
ID: 33585031
I suspect this will not work.  Is there a reason you cannot use two separate IP addresses?
0
 
LVL 3

Expert Comment

by:bobalob
ID: 33585037
You will need to add another IP to the NIC on this server ie 1.2.3.5 - you can do this in network connections from control panel, TCP/IP settings, advanced button.

once you have done this you need to bind IIS to one IP and Tomcat to the other (both port 80)

to bind IIS right click my comp, manage, services and apps, IIS, Web sites, right click web site and properties, choose IP address.

Not sure how to bind tomcat but it will be in one of the settings files (maybe server.xml) in the conf folder no doubt.

update your DNS to point domain1 to 1.2.3.4 and domain2 to 1.2.3.5
0
Network it in WD Red

There's an industry-leading WD Red drive for every compatible NAS system to help fulfill your data storage needs. With drives up to 8TB, WD Red offers a wide array of solutions for customers looking to build the biggest, best-performing NAS storage solution.  

 
LVL 5

Expert Comment

by:helpnet
ID: 33585041
(you beat me too it woolnoir)
0
 
LVL 9

Expert Comment

by:oheil
ID: 33585154
You propably want ot have a tomcat application served on the same domain or IP without needing clients to enter the specific port in their URL.
E.g.
http://www.yourdomain.com/    should give a website
http://www.yourdomain.com/application     should give a the tomcat application

And you do not like to have the application as
http://www.yourdomain.com:PORT/application

Let IIS route all request to http://www.yourdomain.com/application through internally to the tomcat server, which runs on another port. Configure IIS as a proxy for the tomcat server, which runs on the same machine but internally on another port. This port needs only be bind to localhost.

Regards,

Oli

0
 
LVL 15

Accepted Solution

by:
samri earned 500 total points
ID: 33585200
hi Softverkpro,

I believe what you need is a method to divert to the corresponding server according to the request from client.  This could be done in Apache using VirtualHosting and Reverse Proxy facilities.

If you are stucked with IIS and Tomcat on the same box,  I would believe that this could be achieved as well.  

However, being naive on both IIS, and Tomcat, and with little experience on Apache, I would -

1.  setup up apache -- to listen on port 80
2.  Configure Tomcat to listed on 81
3.  configure IIS on port 82
4.  On apache, configure VirtualHosting -- one vhost for each servername - iis, and
5. setup reverse proxy for aeach ot the respective server:port

Some prev post on this subject.

http://www.experts-exchange.com/Software/Server_Software/Web_Servers/Apache/Q_23520183.html
http://www.experts-exchange.com/Software/Server_Software/Web_Servers/Q_22519249.html
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now