Running Shell Script from html webpage

Keith Fernie me at keithfernie.co.uk
Tue Nov 8 14:13:03 UTC 2011


I'am doing this with Debian Squeeze & fcgiwrap installed. I've seen  
fcgiwrap present in Ubuntu.

Example script (Must be executable)

#!/bin/sh
# -*- coding: utf-8 -*-
NAME=`"cpuinfo"`
echo "Content-type:text/html\r\n"
echo "<html><head>"
echo "<title>$NAME</title>"
echo '<meta name="description" content="'$NAME'">'
echo '<meta name="keywords" content="'$NAME'">'
echo '<meta http-equiv="Content-type" content="text/html;charset=UTF-8">'
echo '<meta name="ROBOTS" content="noindex">'
echo "</head><body><pre>"
date
echo "\nuname -a"
uname -a
echo "\ncpuinfo"
cat /proc/cpuinfo
echo "</pre></body></html>"

Run it here http://newhost.qaq.me/cpuinfo.sh

Also using this as an include file, not restricted to only shell scripts.

location ~ (\.cgi|\.py|\.sh|\.pl|\.lua)$ {
gzip off;
root /var/www/$server_name;
autoindex on;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
include /etc/nginx/fastcgi_params;
fastcgi_param DOCUMENT_ROOT /var/www/$server_name;
fastcgi_param SCRIPT_FILENAME /var/www/$server_name$fastcgi_script_name;
}

On Tue, 08 Nov 2011 10:01:07 -0000, etrader <nginx-forum at nginx.us> wrote:

> I have a Nginx installed on Linux (Ubuntu or Centos) without any
> scripting language such as PHP or Python (connected to the webserver).
> Can I run Shell commands from a webpage (e.g. html)?
>
> I mean is it possible to use nginx without script languages by shell
> scripts?
>
> Posted at Nginx Forum: 
> http://forum.nginx.org/read.php?2,217975,217975#msg-217975
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20111108/00775907/attachment.html>


More information about the nginx mailing list