Yes CGI is an old technology. I encounter to be able run an old CGI script for testing on my development project. And i am using Nginx stack rather than install apache. So we can run CGI script with Nginx web server. Here how i do it and documenting it here.
on FreeBSD 9.0 server, we using fcgiwrap application.
#cd /usr/ports/www/fcgiwrap/
#make install clean
Then enable it to run in /etc/rc.conf :
#echo "fcgiwrap_enable='YES'" >> /etc/rc.conf
Then start the fcgiwrap. it will be available in /var/run/fcgiwrap/fcgiwrap.sock
To use it, just redirect the script to be run with fcgiwrap.sock.
Here the nginx setup.
server {
listen 80;
server_name login.freehostspotsystem.com;
location / {
root /usr/local/www/super/system/free;
index index.html index.html;
}
location /cgi-bin/
{
gzip off;
root /usr/local/www/super/system/free;
fastcgi_pass unix:/var/run/fcgiwrap/fcgiwrap.sock;
include /usr/local/etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
And put your cgi file in /usr/local/www/super/system/free/cgi-bin/login.cgi
so when user go to http://login.freehotspotsystem.com/cgi-bin/login.cgi , user will got the page.
0 comments:
Post a Comment