Serving CGI Scripts with Nginx on CentOS 6

In this post I will show you how to serve CGI scripts with Nginx on CentOS 6 using fcgiwrap.

 

As there’s no fcgiwrap package for CentOS 6.0, you must build it yourself. First install some prerequisites:

Now you can build fcgiwrap:

This installs fcgiwrap to /usr/local/sbin/fcgiwrap.

 

1a:

Install the spawn-fcgi package which allows you to run fcgiwrap as a daemon:

 

1b:

If you are already using spawn-fcgi for php, copy the init.d script and sysconfig of spawn-fcgi

Next change the following lines in your spawn-fcgi2 file in /etc/init.d/ to look like this:

 

Then modify your new spawn-fcgi configuration in /etc/sysconfig/to look like this:

 

Now you can start it like any other service. Don’t forget to add it to chkconfig via chkconfig –levels 2345 spawn-fcgi on. (or chkconfig –levels 2345 spawn-fcgi2 on depending on your configuration)

 

The last thing you need to do is to write the nginx configuration.

If you want to user another method, visit http://www.howtoforge.com/serving-cgi-scripts-with-nginx-on-debian-squeeze-ubuntu-11.04.

flattr this!

3 thoughts on “Serving CGI Scripts with Nginx on CentOS 6

  1. Pingback: CentOS上搭建Git服务器| 不想飞的蛤蟆不是好刺猬

Leave a Reply