# Running Shell Script from html webpage

**URL:** <https://www.ruby-forum.com/t/running-shell-script-from-html-webpage/213662>\
**Category:** NGINX\
**Created:** [November 8, 2011, 11:01am UTC](https://www.ruby-forum.com/t/running-shell-script-from-html-webpage/213662 "2011-11-08T11:01:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [November 8, 2011, 11:01am UTC](https://www.ruby-forum.com/t/running-shell-script-from-html-webpage/213662/1 "2011-11-08T11:01:36Z")

</div>

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:

> **[Running Shell Script from html webpage](https://forum.nginx.org/read.php?2,217975,217975#msg-217975)**
>
> 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...

---

<div class="post-metadata">

**Author:** ![etrader](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/b5e925/32.png) [@etrader](https://www.ruby-forum.com/u/etrader)\
**Post date:** [November 8, 2011, 12:23pm UTC](https://www.ruby-forum.com/t/running-shell-script-from-html-webpage/213662/2 "2011-11-08T12:23:24Z")

</div>

Hello, well you can use a web anti-framework, that will enable you to  
use  
shell power. You can also use a RC templata to place the code into the  
html.  
Here is a link to werc [http://www.werc.org/](http://www.werc.org/)

---

<div class="post-metadata">

**Author:** ![etrader](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/b5e925/32.png) [@etrader](https://www.ruby-forum.com/u/etrader)\
**Post date:** [November 8, 2011, 3:14pm UTC](https://www.ruby-forum.com/t/running-shell-script-from-html-webpage/213662/3 "2011-11-08T15:14:07Z")

</div>

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 “”  
echo “$NAME”  
echo ‘’  
echo ‘’  
echo ‘’  
echo ‘’  
echo “

```
”
date
echo “\nuname -a”
uname -a
echo “\ncpuinfo”
cat /proc/cpuinfo
echo “
```
”

Run it here [http://newhost.qaq.me/cpuinfo.sh](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;  
}
