0

How can I use nginx as a whois server with PHP-FPM? I am unable to find any way to do this.

And editing the source would take a long time. Because, the source is built for HTTP purpose mainly, and reverse proxying.

So what I want is:

User's request:

$ telnet whois.myexampledomain.com 43
example.com

Server's reply:

Domain Name: example.com
Registry Domain ID: ...
Registrar WHOIS Server: whois.exampleregistrar.com
Registrar URL: https://domains.exampleregistrar.com
Updated Date: 2020-11-01T01:11:39Z
Creation Date: 2017-11-01T01:11:39Z
...

And then nginx immediately needs to close that connection after responding with the whois.

So to be clear again, this needs to work like:

Client (makes connection, and then sends the domain name) => nginx (executes a PHP file using PHP-FPM) => PHP-FPM (connects to MySQL DB) => MySQL DB (containing WHOIS info)
Client <= nginx (sends back to the client and closes connection immediately after doing so) <= PHP-FPM (sends back to nginx as plain text without any HTML stuff) <= MySQL DB containing WHOIS info (sends back the requested rows/columns)

Side note:
For Apache, I found a module called mod_whois, but it does this:

Client => Apache (mod_whois) => Apache (HTTP) => PHP-FPM => MySQL DB

And it creates un-necessary overload by using Apache twice.

And because apache contains so many modules which would go to waste, I decided to use nginx for this.

  • 1
    I was going to say: *"You don't."* and *"Why would you attempt to use a web server, designed to speak the http protocol, to answer queries for a completely different protocol, the whois protocol?"* but then I remembered: https://en.wikipedia.org/wiki/Law_of_the_instrument – Bob Mar 04 '21 at 16:08
  • 1
    The more "obvious" solution is to use a WHOIS server that can directly use a MySQL database as the backend such as https://github.com/openprovider/whoisd – Bob Mar 04 '21 at 16:10
  • @HermanB, That openprovider's whois is not useful as I do not use 'GO' at all! – Example person Mar 04 '21 at 17:00
  • nginx is an HTTP / HTTPS server and TCP stream proxy. It is not the tool for what you want. You need to find a proper tool. – Tero Kilkanen Mar 04 '21 at 21:29
  • @HermanB, also, the whois protocol is very simple. It uses TCP like HTTP/1.1. And, you can change nginx to work with it. But a lot of effort if you are modifying source. – Example person Mar 05 '21 at 05:35
  • 1
    You probably don’t consider it nearly as funny as I do - but you really made my day by confirming that you cannot consider any alternate solution because it is not based on the tools you’re familiar with. – Bob Mar 05 '21 at 08:15

0 Answers0