Post Reply 
Run cgi scripts on nginx
04-22-2011, 02:43 AM (This post was last modified: 01-22-2012 09:29 AM by dmmcintyre3.)
Post: #1
Run cgi scripts on nginx
Note: This assumes you used my CentOS 5 nginx installer script

First, install thttpd.
Code:
yum -y install thttpd

Next, install the config files.

/etc/thttpd.conf:
Code:
# BEWARE : No empty lines are allowed!
# This section overrides defaults
dir=/var/www/
#chroot
user=apache       # default = nobody
logfile=/var/log/thttpd.log
pidfile=/var/run/thttpd.pid
port=85
novhost
cgipat=**.cgi
host=127.0.0.1

Add to the end of /etc/nginx/php:
Code:
location ~ .*\.(cgi)?$ {
          proxy_pass http://127.0.0.1:85/$server_name$uri;
          }

Restart nginx and enable thttpd:
Code:
service nginx restart; chkconfig thttpd on; service thttpd start

KVM2 (VPS 15, 19 and 25) Munin report | Check your VPS 15, 19 or 25's IOPS usage
User Tools
Quote this message in a reply


04-22-2011, 03:07 AM
Post: #2
RE: Run cgi scripts on nginx
Oh, I've always wanted something like this!

"I like to put random quotes, to make myself look clever."
- WiseMannnn
User Tools
Quote this message in a reply
04-22-2011, 11:35 PM
Post: #3
RE: Run cgi scripts on nginx
An alternative is Fcgiwrap, http://wiki.nginx.org/Fcgiwrap , which is generally what most people use for CGI on nginx.

Another is http://wiki.nginx.org/SimpleCGI , but that is more of a hack.

Choose whatever works best for you.
User Tools
Quote this message in a reply
04-23-2011, 03:43 AM
Post: #4
RE: Run cgi scripts on nginx
I tried FCGI Wrap, but I couldn't get it running properly.

Never heard of SimpleCGI.

"I like to put random quotes, to make myself look clever."
- WiseMannnn
User Tools
Quote this message in a reply
Post Reply 


Forum Jump:



User(s) browsing this thread:
1 Guest(s)