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.