Hosting several sites on the same host
Omar Polo
op at omarpolo.com
Wed Dec 2 10:25:25 GMT 2020
Côme Chilliet <come at chilliet.eu> writes:
> Hello,
>
> I’m lost with how sockets and TLS works, how can I host several gemini sites on the same host?
>
> I cannot read the request before setting up TLS, but I need to know which hostname is requested to serve the correct certificate.
>
> So I guess either:
> 1) It’s possible to have several programs listen on the same port using different hostname?
> 2) It’s possible for a program which listen on a port to know which hostname was requested before TLS handshake?
>
> I use stream_socket_server and stream_socket_accept in PHP and did not find how to get requested hostname.
>
> I did not find good documentation on the purpose of the target in the socket name. I use tcp://[::]:1965 currently.
> I do not understand what it does to put a hostname instead of [::] in there.
>
> Côme
You should use the Server Name Indication (SNI) TLS extension. Gemini
clients have to support SNI, by the spec. Basically, clients in the TLS
handshake will tell you to which hostname they want to talk to, so you
can use the appropriate certificate.
Unfortunately I am not knowledgable in PHP, so I cannot help you further.
More information about the Gemini
mailing list