Running multi-site locally
t
Hi all I have setup two sites under one Umbraco 13. I can get to one site but not the other so I setup the culture and host as below Site 1 - http://localhost:1234 Site 2 - http://localhost:1234/siteTwo This works and I'm able to get to the second site. Is the only way to have these working for two separate domains is if I had two domains as Site 1 - http://domainOne Site 1 - http://domaintwo Is by setting up IIS on my machine? So I can't do this using IIS express (that comes with Visual Studio)?
k
IIS Express requires alot of haxx to listen on non-localhost. I'd setup IIS and use
siteone.localho.st
which already has DNS. You may need to create and install self-signed certificates since the ASP.NET development certificates won't apply, or maybe you could use non-https to browse the frontends. Still, it feels like there should be an easier way... **EDIT**: There is, see rest of thread
d
Closest I've gotten is with Kestrel and hosting on multiple ports on localhost
k
How do you actually do that for the same web project? Just setup multiple application URLs in the launch profile?
d
yes, exactly. There is the
applicationUrl
option and you can add multiple base urls separated by semicolons
k
That's hella easier than my suggestion 🙂
t
Do you have a link I could review as I'm not sure what I'm doing to get this working with kestrel?
Line 34 is especially relevant for you
l
I have followed what you have on line 34 and got mine working, thanks for that! I had app.UseHttpsRedirection() in my startup.cs file, make sure that is disabled or it will just redirect you to the https version (anyone reading this)
j
FYI, you can pop as many URLs in there as you want - and they can all be HTTPS if you want...
Copy code
"applicationUrl": "https://localhost:44345;https://localhost:44346;https://localhost:44347",
t
So you mean just add line 34?
a
Some guy here had an real easy multi-site option also for IIS express... But I can't remember who it was
l
@Jason @D_Inventor @kdx-perbol as for configuring this on a production basis, point both domains to the site folder, and configure in Umbraco under the configure host names?
This is what I did, then run and configure the pages in Umbraco
d
I'm not really sure what you mean by "point domains to folders". As long as the domain points to your application, you can let umbraco do the rest
j
Also, if port numbers are a pain I believe you can get kestrel to use wildcards for any given port including 80/443. So long as you set up your hosts file you could feasibly get any domain working locally.
d
If you run on windows then you have to keep in mind that iis usually occupies ports 80 and 443, at least if you're using iis at all
j
My aim is to never install IIS on a development machine ever again. It installs and turns on a lot of stuff that a development machine shouldn't really have installed/enabled.
146 Views