Perl + fcgi + nginx - what am I doing wrong?

youradds nginx-forum at
Fri Jul 31 12:55:44 UTC 2015


I've already got a live + dev site running under nginx and perl (with fcgi),
but I can't for the life of me work out why its not working this time
around. I've setup a new dev server. I wont bore you with all of the
details, but suffice to say I have installed (via apt-get);

    sudo apt-get update && sudo apt-get upgrade
    sudo apt-get install nginx
    sudo apt-get install php5-cli php5-cgi spawn-fcgi php-pear
    sudo apt-get install mysql-server php5-mysql
    sudo apt-get install fcgiwrap

The OS is Debian 8.1.

I have then configured my site, using:

    server {
        listen   80;
        access_log /srv/www/;
        error_log /srv/www/;
        root /srv/www/;
     location / {
            index  index.html index.htm;
    	location ~ \.php$ {
            try_files $uri =404;
            include /etc/nginx/fastcgi_params;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME
    	location ~ \.cgi$ {
                try_files $uri =404;
                gzip off;
                include /etc/nginx/fastcgi_params;
                fastcgi_pass unix:/var/run/fcgiwrap.socket;
                fastcgi_index index.cgi;
                fastcgi_param SCRIPT_FILENAME

I've sym-linked the config files into sites-enabled, so that its visible on
nginx. I then rebooted nginx, and tried:

    index.html - works fine
    index.php - works fine
    index.cgi - 403 error

I managed to fumble my way through it last time, but I can't figure out what
I did different (I know it was a real pig to get configured the first time

Any suggestions from the experts?

(appologies for the formatting of this post - can't figure out how to do



Posted at Nginx Forum:,260678,260678#msg-260678

More information about the nginx mailing list