#1 2025-08-18 11:55:13

loki
Member
Registered: 2018-01-20
Posts: 15

Serve multiple hostnames on one IP with separate mORMot binaries

I need to host several sites on the same server/IP, for example:

* api.mydomain.com → API service
* www.mydomain.com → website

Each must run in its own mORMot binary/process (not in one app).

Questions:

* Is it possible for two mORMot processes to both listen on port 80/443 and be split by hostname?
* On Windows/http.sys (THttpApiServer): can I register different hostnames so each process handles its own domain?

If reverse proxy is the only option:

Any mORMot-specific notes for X-Forwarded-For, TLS offload, HTTP/2, or WebSockets?

Goal:

* One IP address
* Separate binaries per site
* Clean HTTPS setup (Let’s Encrypt etc.)

What’s the recommended approach?

Offline

#2 2025-08-18 12:23:43

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 15,159
Website

Re: Serve multiple hostnames on one IP with separate mORMot binaries

The easiest is to use a nginx reverse proxy in front of your servers, which handle the static website and HTTPS.

Offline

#3 2025-08-19 06:26:28

loki
Member
Registered: 2018-01-20
Posts: 15

Re: Serve multiple hostnames on one IP with separate mORMot binaries

Thanks @ab. I need to think about it, because that means in the end I’d be replacing my current IIS + ISAPI setup with an NGINX + mORMot setup. I’m not sure it would really be less complex. sad The goal was to have a single binary for each of my website that I could just deploy to get the website running (plus configuring the firewall, of course).

Offline

#4 2025-08-19 07:07:53

pvn0
Member
From: Slovenia
Registered: 2018-02-12
Posts: 215

Re: Serve multiple hostnames on one IP with separate mORMot binaries

Another thumbs up for nginx, also just this week they announced ACME support so it will be even easier then ever to auto renew ssl certificates (such as LetsEncrypt).

Offline

#5 2025-08-19 09:57:08

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 15,159
Website

Re: Serve multiple hostnames on one IP with separate mORMot binaries

If you want a single binary, you could also do all this with a single mORMot HTTP server.
Your website is full static (no php), right?

On Windows, you can use the mORMot http.sys server, which are able to share the same port with several mORMot binaries.
Then you need to register each domain using e.g.

netsh http add urlacl url=http://main.domain.com:80/ user=Everyone
netsh http add urlacl url=http://domain.com:80/ user=Everyone

Just ask grok for this standard behavior - but it is almost the same as how IIS works, because http.sys is also used by IIS.

Offline

#6 2025-08-19 12:20:39

koraycayiroglu
Member
Registered: 2017-02-03
Posts: 70

Re: Serve multiple hostnames on one IP with separate mORMot binaries

Another thumbs up, nginx is the way to go

Offline

#7 2025-08-19 12:41:04

loki
Member
Registered: 2018-01-20
Posts: 15

Re: Serve multiple hostnames on one IP with separate mORMot binaries

Thanks @AB, yes i do not use any php. I will study http.sys with mORMot thanks a lot !

Offline

#8 2025-08-19 18:34:14

loki
Member
Registered: 2018-01-20
Posts: 15

Re: Serve multiple hostnames on one IP with separate mORMot binaries

pvn0 wrote:

Another thumbs up for nginx, also just this week they announced ACME support so it will be even easier then ever to auto renew ssl certificates (such as LetsEncrypt).

koraycayiroglu wrote:

Another thumbs up, nginx is the way to go

Yes, but NGINX isn’t really designed for Windows, and even its own developers do not recommend running it there.
(see: https://nginx.org/en/docs/windows.html
: “high performance and scalability should not be expected”).

That’s why I’m still wondering: is it really a good idea to replace IIS + ISAPI with NGINX (limited on Windows) + mORMot?

Last edited by loki (2025-08-19 18:34:53)

Offline

#9 2025-08-19 18:58:20

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 15,159
Website

Re: Serve multiple hostnames on one IP with separate mORMot binaries

nginx is indeed no option on Windows.

Offline

#10 2025-08-19 20:32:51

koraycayiroglu
Member
Registered: 2017-02-03
Posts: 70

Re: Serve multiple hostnames on one IP with separate mORMot binaries

i use nginx on windows server for my customer with wildcard ssl certificate to host an react-native web application and couple of api services written with mormot with no issues. it's not designed for windows yes, but still usable for reverse-proxy. i don't know what your setup is and how much work will it need but for my own company, i installed an ubuntu server+nginx that handles requests and reverse-proxy them to my other windows servers using iss+isapi at the back-end and don't expose them to internet directly. I believe it's more secure this way.

Last edited by koraycayiroglu (2025-08-19 20:43:38)

Offline

#11 2025-08-21 11:44:02

itSDS
Member
From: Germany
Registered: 2014-04-24
Posts: 573

Re: Serve multiple hostnames on one IP with separate mORMot binaries

there is a solution for iis we use, Install URL Rewrite 2.0 or higher and ARR (Application Request Routing Cache) Work perfekt !


Rad Studio 12.3 Athens / 13.0 Ganymede

Offline

#12 2025-08-21 13:48:47

danielkuettner
Member
From: Germany
Registered: 2014-08-06
Posts: 401

Re: Serve multiple hostnames on one IP with separate mORMot binaries

loki wrote:

That’s why I’m still wondering: is it really a good idea to replace IIS + ISAPI with NGINX (limited on Windows) + mORMot?

Nginx runs always on a linux (proxy).
The mORMot2 service can now run on linux or (in your case) windows.

Offline

Board footer

Powered by FluxBB