Welcome! Log In Create A New Profile

Advanced

Re: Running Shell Script from html webpage

Keith Fernie
November 08, 2011 09:14AM
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@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@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Running Shell Script from html webpage

etrader November 08, 2011 05:01AM

Re: Running Shell Script from html webpage

Alfredo Palhares November 08, 2011 06:24AM

Re: Running Shell Script from html webpage

Keith Fernie November 08, 2011 09:14AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 248
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