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.






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