Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running multiple ASP.NET Core RC2 Applications on the same port

I want to be able to run two applications using the same port on the same server. My challenge is both applications have a host file that contains the URL it's listening for on port 80. Usually a web server has the ability to create virtual hosts, but I have no idea what I should be doing in this situation (except googling for a solution).

like image 300
user2330898 Avatar asked Jun 01 '16 13:06

user2330898


1 Answers

In a production environment you typically want to use a reverse proxy to forward requests to your sites running on Kestrel. You set up your ASP.NET Core applications to run on different ports, i.e. http://example.com:5000 and http://example.com:5001. Then you use IIS, Apache, nginx or similar to act as a reverse proxy. The reverse proxy is listening on port 80 and is forwarding the incoming requests to your Kestrel instances.

Example:

http://example.com/app1 --> http://example.com:5000
http://example.com/app2 --> http://example.com:5001
like image 111
henningst Avatar answered Oct 11 '22 19:10

henningst