nginx: can I show output of a shell command on a specific url?

Solution 1:

nginx lacks CGI support so it can't execute any scripts directly. You'll need to setup FastCGI server and call it from nginx by using fastcgi_pass in your location directive. There is example of such FastCGI wrapper in nginx wiki - see this link.

Solution 2:

You can just write a small PHP or perl file and put it in the required path. This small file will execute the script or commands you want and print the output. You can use the backquotes `command` to do this.