开发者

Can nginx run a unix command based on url?

Is it possible to configure nginx to run a unix command based on a url?

For example:

http://localhost/list/usr/local
开发者_Go百科

This runs:

ls /usr/local

Then returns the results?


No, Nginx cannot.


Nginx is able to run perl scripts when it's built with perl support. And it seems that you can program enything that can be done with a plain perl.

I think you should look at this direction.

While expirementing with perl you should keep in mind that perl interpreter blocks nginx process until finished so it's not recomended to run long-lasting jobs.

BTW: Perl support still marked as experimental.


You can use Perl module for this task.

Nginx Perl module

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜