当前位置: 首页 > 工具软件 > fastcgi++ > 使用案例 >

ubuntu搭建nginx+fastcgi框架

傅越
2023-12-01

记录下ginx+fastcgi框架搭建过程。

一、安装

1、安装spawn-fcgi(spawn-fcgi-1.6.4)

依次执行:

./configure  ;make;sudo make install;

若执行spawn-fcgi成功,则说明spawn-fcgi安装成功。

2、安装fcgi(fcgi-2.4.1-SNAP-0910052249 )

依次执行:

./configure  ;make;sudo make install;

3. 安装fcgiwrap

依次执行:

autoreconf -i;  

export ac_cv_func_malloc_0_nonnull=yes;

./configure;make ;sudo make install;

若执行fcgiwrap -h有正常帮助信息显示,则说明fcgiwrap安装成功。

二、配置

再nginx.conf加入配置信息

location  /cgi-bin/login{
          #配置fastcgi模块                                             
          fastcgi_pass 127.0.0.1:9002;
          fastcgi_index login.exe;
          include fastcgi.conf;
        }
        
        location  /cgi-bin/data{
              #配置fastcgi模块                                             
              fastcgi_pass 127.0.0.1:9003;
              fastcgi_index data.exe;
              include fastcgi.conf;
        }
        
        location  /cgi-bin/fileUpload{
              #配置fastcgi模块                                             
              fastcgi_pass 127.0.0.1:9004;
              fastcgi_index fileUpload.exe;
              include fastcgi.conf;
        }
    
        location  /cgi-bin/logFile{
              #配置fastcgi模块                                             
              fastcgi_pass 127.0.0.1:9005;
              fastcgi_index logFile.exe;
              include fastcgi.conf;
        }
        
        location  /cgi-bin/update{
              #配置fastcgi模块                                             
              fastcgi_pass 127.0.0.1:9006;
              fastcgi_index update.exe;
              include fastcgi.conf;
        }
        
        location  /cgi-bin/update_for_db{
              #配置fastcgi模块                                             
              fastcgi_pass 127.0.0.1:9007;
              fastcgi_index update_for_db.exe;
              include fastcgi.conf;
        }
        
        location  /cgi-bin/xmlSave{
              #配置fastcgi模块                                             
              fastcgi_pass 127.0.0.1:9008;
              fastcgi_index xmlSave.exe;
              include fastcgi.conf;
        }
        
        location  /cgi-bin/databaseManage{
              #配置fastcgi模块                                             
              fastcgi_pass 127.0.0.1:9009;
              fastcgi_index databaseManage.exe;
              include fastcgi.conf;
        }

 使用spawn-fcgi绑定cgi程序。

sudo spawn-fcgi -a 127.0.0.1 -p 9002 -f /mnt/hgfs/AcCam_WORK/05_Demo/www/cgi-bin/login.exe;
sudo spawn-fcgi -a 127.0.0.1 -p 9003 -f /mnt/hgfs/AcCam_WORK/05_Demo/www/cgi-bin/data.exe; 
sudo spawn-fcgi -a 127.0.0.1 -p 9004 -f /mnt/hgfs/AcCam_WORK/05_Demo/www/cgi-bin/fileUpload.exe; 
sudo spawn-fcgi -a 127.0.0.1 -p 9005 -f /mnt/hgfs/AcCam_WORK/05_Demo/www/cgi-bin/logFile.exe; 
sudo spawn-fcgi -a 127.0.0.1 -p 9006 -f /mnt/hgfs/AcCam_WORK/05_Demo/www/cgi-bin/update.exe; 
sudo spawn-fcgi -a 127.0.0.1 -p 9007 -f /mnt/hgfs/AcCam_WORK/05_Demo/www/cgi-bin/update_for_db.exe; 
sudo spawn-fcgi -a 127.0.0.1 -p 9008 -f /mnt/hgfs/AcCam_WORK/05_Demo/www/cgi-bin/xmlSave.exe; 
sudo spawn-fcgi -a 127.0.0.1 -p 9009 -f /mnt/hgfs/AcCam_WORK/05_Demo/www/cgi-bin/databaseManage.exe; 

 类似资料: