Run Grafana with https on same server with another app using https

Hello all,
I am quite new to Grafana , so please take it easy on me :slight_smile:
I am trying to setup an app called SEQ on the same server (Windows Server 2012 R2) where Grafana is installed.
My problem is that SEQ cannot start , and getting this error :
The Seq server could not be started","@l":“Fatal”,"@x":"Microsoft.AspNetCore.Server.HttpSys.HttpSysException (32): The process cannot access the file because it is being used by another process

If I stop Grafana , I can start SEQ without any issues .

My guess is that Grafana is bind to the 443 port instead of grafana.mydomain.com:443 as we want it to be.

Is there a way to set Grafana to respond only to requests sent tografana.mydomain.com:443, instead of responding to all requests on port 443?

The defaults.ini is as below:

[server]

Protocol (http, https, socket)

protocol = https

The ip address to bind to, empty will bind to all interfaces

http_addr =

The http port to use

http_port = 443

The public facing domain name used to access grafana from a browser

domain = mydomain (FQDN name is here)

Redirect to correct domain if host header does not match domain

Prevents DNS rebinding attacks

enforce_domain = false

The full public facing url

root_url = %(protocol)s://%(domain)s:%(http_port)s/

We are not using a reverse proxy , and IIS is not installed on that server, if it helps in any way.

Thanks!

I am trying to setup an app called SEQ

What is that?

My problem is that SEQ cannot start, and getting this error :
The Seq server could not be started", “@l”: “Fatal”, “@x”:
"Microsoft.AspNetCore.Server.HttpSys.HttpSysException (32): The process
cannot access the file because it is being used by another process

Do you know which file is being referred to?

It would be a strange error message to produce if it really means a network
socket.

My guess is that Grafana is bind to the 443 port instead of
grafana.mydomain.com:443 as we want it to be.

What makes you think this is a network socket problem rather than a file access
problem?

Is there a way to set Grafana to respond only to requests sent to
grafana.mydomain.com:443, instead of responding to all requests on port
443?

Yes, provided you have at least two IP addresses on the server, and
grafana.mydomain.com resolves to one of them, then you can use the other one
for SEQ.

The defaults.ini is as below:

[server]

Protocol (http, https, socket)

protocol = https

The ip address to bind to, empty will bind to all interfaces

http_addr =

So, set here the IP address which grafana.mydomain.com resolves to, and it
will only bind to that address.

The tell SEQ to bind to the other address, and they won’t conflict (assuming
that that really is your problem).

Regards,

Antony.

Hi,
SEQ - it’s a centralized log collector

I think the C:\Windowds\system32\drivers\http.sys file is in use.
The problem is not file access for sure, as SEQ starts without any issues when Grafana is stopped.

I do not have 2 IPs on that machine, and not planning to have them in the future.

So, if we do not have 2 IPs, it shouldn’t be possible to make it work?

Maybe using “netsh http add urlacl” command? Not sure of the impact it will have on Grafana .

Thanks again!

Hi,
SEQ - it’s a centralized log collector

I think the C:\Windowds\system32\drivers\http.sys file is in use.

So, it’s a file, not a web socket…?

The problem is not file access for sure, as SEQ starts without any issues
when Grafana is stopped.

And, how would the behaviour be any different if you believed the two
applications were fighting over access to a file?

Run one, no problem; stop it and run the other, again no problem; run both,
and there’s a problem…

I do not have 2 IPs on that machine, and not planning to have them in the
future.

In that case you can’t have two things both listening on the same port.

So, if we do not have 2 IPs, it shouldn’t be possible to make it work?

Well, why not make one or the other listen on a different port number?

Maybe using “netsh http add urlacl” command? Not sure of the impact it
will have on Grafana .

I cannot comment on that because I have no familiarity with how Windows does
such things.

Antony.

Try setting Grafana to use another port than 443. Even if you really need to have it on port 443 later, try setting it to another port to make sure your assertion that the port allocation is the problem is correct.

If you need both to be accessible at port 443 but on different domains you’ll need something like a reverse proxy to set that up. A reverse proxy allows you to expose both Grafana and SEQ on other ports, and the reverse proxy on 443 which will forward traffic to the applications. I’m not a Windows user, but it seems like you can use IIS’s url rewrite for this, otherwise the most popular reverse proxy on the market is nginx or envoy.

So, it’s a file, not a web socket…?

From what I understand from other forums related to the error I get, if Grafana or any other app, has exclusive access to port 443, it blocks that file. At least this is how I understand it. Setting services to listen to their own socket would fix it.

In that case you can’t have two things both listening on the same port.
Well, why not make one or the other listen on a different port number?

I wanted to avoid this as there are 2 different firewalls (also providers) to be configured to allow the communication. So it will take some time get it done. In the end this might be the only option.

Many thanks!

The final solution was to leave Grafana on port 443 and move SEQ to port 8443 (also opened the ports).
Thank you!