Welcome! Log In Create A New Profile

Advanced

Re: Can I serve CLI Applications using Nginx

Francis Daly
July 02, 2022 04:54AM
On Thu, Jun 23, 2022 at 07:13:34PM +0600, Ahmad Ismail wrote:

Hi there,

> will it be a bad idea to extend nginx (ex. create a module) to serve
> my purpose instead of using inetd? Is it possible to make a module that
> will give the HTTP request to `Command1 | Command2 | CommandN`, then build
> a response from the output (by adding HTTP response message to it) and
> then send the response back to the client.

You can try that, but I suspect that you will find that you are
re-inventing CGI.

Your initial model of

Request | Web_Server | CLI_APP | ADD_UI | Web_Server > Response

is, I think, not quite right -- the "Web_Server" is not in the pipeline
twice; instead, the CLI_APP part is "off to the side".

Since you want the request to come in as http, you will probably be
happier if you keep your CLI_APP and ADD_UI pieces as they are in a
pipeline; but have a CGI wrapper that will call them and provide the
headers that any CGI-supporting web server will know how to handle.

As it happens -- nginx does not support CGI. So if you want to use nginx
in this model, you will want something like a FastCGI wrapper, or SCGI
wrapper, or something else that speaks a protocol that nginx does support.

For testing/design, you could use something like "date" as your dummy
CLI_APP; and then learn what you need to do to end up with the current
time showing in the browser.

I expect that you will either design your own interfaces that only work
in this case; or you will use pre-existing interfaces like CGI.

Good luck with it,

f
--
Francis Daly francis@daoine.org
_______________________________________________
nginx mailing list -- nginx@nginx.org
To unsubscribe send an email to nginx-leave@nginx.org
Subject Author Posted

Can I serve CLI Applications using Nginx

ismail783 June 22, 2022 10:36AM

Re: Can I serve CLI Applications using Nginx

Lyndon Nerenberg (VE7TFX/VE6BBM) June 22, 2022 01:26PM

Re: Can I serve CLI Applications using Nginx

ismail783 June 23, 2022 01:20AM

Re: Can I serve CLI Applications using Nginx

ismail783 June 23, 2022 09:16AM

Re: Can I serve CLI Applications using Nginx

Francis Daly July 02, 2022 04:54AM

Re: Can I serve CLI Applications using Nginx

ismail783 July 04, 2022 09:32AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 279
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready