Solved

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

Posted on 2010-09-02
6
832 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
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

831 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