Solved

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

Posted on 2010-09-02
6
816 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
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
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

Superior storage. Superior surveillance.

WD Purple drives are built for 24/7, always-on, high-definition security systems. With support for up to 8 hard drives and 32 cameras, WD Purple drives are optimized for surveillance.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Running classic asp applications under Windows Server 2008 R2 (x64) and IIS 7 is not as easy as one may think. It took me a while to figure it out while getting error 8002801d a few times. After you install the OS you will need to install the fol…
Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

867 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

22 Experts available now in Live!

Get 1:1 Help Now