Perl+;nginx 403再次出错

Perl+;nginx 403再次出错,perl,nginx,Perl,Nginx,让Perl和nginx发挥作用似乎是一场永无止境的战斗:(我已经安装了一个新的开发服务器。我不会让你厌烦所有的细节,但我已经安装了(通过apt get) 然后,我使用以下工具配置了我的站点: server { listen 80; server_name site.net.net www.site.net.net; access_log /srv/www/site.net.net/logs/access.log; error_log /srv/www/si

让Perl和nginx发挥作用似乎是一场永无止境的战斗:(我已经安装了一个新的开发服务器。我不会让你厌烦所有的细节,但我已经安装了(通过apt get)

然后,我使用以下工具配置了我的站点:

server {

    listen   80;

    server_name site.net.net www.site.net.net;
    access_log /srv/www/site.net.net/logs/access.log;
    error_log /srv/www/site.net.net/logs/error.log;
    root /srv/www/site.net.net/www;

 location / {
        index  index.html index.htm;
    }

    location ~ \.php$ {
        try_files $uri =404;
        include /etc/nginx/fastcgi_params;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME /srv/www/site.net.net/www$fastcgi_script_name;
    }

    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 /srv/www/site.net.net/www/cgi-bin/$fastcgi_script_name;
        }

}
我已将配置文件sym链接到已启用的站点,以便其在nginx上可见。然后我重新启动nginx,并尝试:

index.html - works fine
index.php - works fine
index.cgi - 403 error
上次我设法摸索了一下,但我不知道我做了什么不同(我知道第一次配置真的很麻烦)

错误日志中显示的唯一内容是:

2015/07/31 15:52:25 [error] 10434#0: *7 open() "/srv/www/site.net/www/favicon.ico" failed (2: No such file or directory), client: 81.174.134.xx, server: sitenet, request: "GET /favicon.ico HTTP/1.1", host: "site.net"
所以没什么帮助:/

专家们有什么建议吗

更新:

如果我将错误日志更新为“调试”级别,即:

error_log /srv/www/steampunkjunkiesdev.net/logs/error.log debug;
…下面是输出的内容(仅来自一个请求)。但不确定其中是否有任何有用的内容

Server: nginx/1.6.2
Date: Fri, 31 Jul 2015 15:11:49 GMT
Content-Type: text/html
Transfer-Encoding: chunked
Connection: keep-alive
Content-Encoding: gzip

2015/07/31 16:11:49 [debug] 3557#0: *1 write new buf t:1 f:0 0000000000F049D8, pos 0000000000F049D8, size: 185 file: 0, size: 0
2015/07/31 16:11:49 [debug] 3557#0: *1 http write filter: l:0 f:0 s:185
2015/07/31 16:11:49 [debug] 3557#0: *1 http output filter "/favicon.ico?"
2015/07/31 16:11:49 [debug] 3557#0: *1 http copy filter: "/favicon.ico?"
2015/07/31 16:11:49 [debug] 3557#0: *1 image filter
2015/07/31 16:11:49 [debug] 3557#0: *1 xslt filter body
2015/07/31 16:11:49 [debug] 3557#0: *1 http postpone filter "/favicon.ico?" 0000000000F04AF8
2015/07/31 16:11:49 [debug] 3557#0: *1 http gzip filter
2015/07/31 16:11:49 [debug] 3557#0: *1 malloc: 0000000000EED690:12288
2015/07/31 16:11:49 [debug] 3557#0: *1 gzip alloc: n:1 s:5936 a:8192 p:0000000000EED690
2015/07/31 16:11:49 [debug] 3557#0: *1 gzip alloc: n:512 s:2 a:1024 p:0000000000EEF690
2015/07/31 16:11:49 [debug] 3557#0: *1 gzip alloc: n:512 s:2 a:1024 p:0000000000EEFA90
2015/07/31 16:11:49 [debug] 3557#0: *1 gzip alloc: n:512 s:2 a:1024 p:0000000000EEFE90
2015/07/31 16:11:49 [debug] 3557#0: *1 gzip alloc: n:256 s:4 a:1024 p:0000000000EF0290
2015/07/31 16:11:49 [debug] 3557#0: *1 gzip in: 0000000000EF6EE8
2015/07/31 16:11:49 [debug] 3557#0: *1 gzip in_buf:0000000000F04AA8 ni:00000000006DC600 ai:116
2015/07/31 16:11:49 [debug] 3557#0: *1 malloc: 0000000000EF06A0:4096
2015/07/31 16:11:49 [debug] 3557#0: *1 deflate in: ni:00000000006DC600 no:0000000000EF06A0 ai:116 ao:4096 fl:0 redo:0
2015/07/31 16:11:49 [debug] 3557#0: *1 deflate out: ni:00000000006DC674 no:0000000000EF06A0 ai:0 ao:4096 rc:0
2015/07/31 16:11:49 [debug] 3557#0: *1 gzip in_buf:0000000000F04AA8 pos:00000000006DC600
2015/07/31 16:11:49 [debug] 3557#0: *1 gzip in: 0000000000EF6EF8
2015/07/31 16:11:49 [debug] 3557#0: *1 gzip in_buf:0000000000EF6E20 ni:00000000006DCDA0 ai:52
2015/07/31 16:11:49 [debug] 3557#0: *1 deflate in: ni:00000000006DCDA0 no:0000000000EF06A0 ai:52 ao:4096 fl:4 redo:0
2015/07/31 16:11:49 [debug] 3557#0: *1 deflate out: ni:00000000006DCDD4 no:0000000000EF0711 ai:0 ao:3983 rc:1
2015/07/31 16:11:49 [debug] 3557#0: *1 gzip in_buf:0000000000EF6E20 pos:00000000006DCDA0
2015/07/31 16:11:49 [debug] 3557#0: *1 free: 0000000000EED690
2015/07/31 16:11:49 [debug] 3557#0: *1 http chunk: 10
2015/07/31 16:11:49 [debug] 3557#0: *1 http chunk: 121
2015/07/31 16:11:49 [debug] 3557#0: *1 write old buf t:1 f:0 0000000000F049D8, pos 0000000000F049D8, size: 185 file: 0, size: 0
2015/07/31 16:11:49 [debug] 3557#0: *1 write new buf t:1 f:0 0000000000EF7058, pos 0000000000EF7058, size: 4 file: 0, size: 0
2015/07/31 16:11:49 [debug] 3557#0: *1 write new buf t:0 f:0 0000000000000000, pos 00000000006E0240, size: 10 file: 0, size: 0
2015/07/31 16:11:49 [debug] 3557#0: *1 write new buf t:1 f:0 0000000000EF06A0, pos 0000000000EF06A0, size: 121 file: 0, size: 0
2015/07/31 16:11:49 [debug] 3557#0: *1 write new buf t:0 f:0 0000000000000000, pos 00000000004B2EB8, size: 7 file: 0, size: 0
2015/07/31 16:11:49 [debug] 3557#0: *1 http write filter: l:1 f:1 s:327
2015/07/31 16:11:49 [debug] 3557#0: *1 http write filter limit 0
2015/07/31 16:11:49 [debug] 3557#0: *1 writev: 327
2015/07/31 16:11:49 [debug] 3557#0: *1 http write filter 0000000000000000
2015/07/31 16:11:49 [debug] 3557#0: *1 http copy filter: 0 "/favicon.ico?"
2015/07/31 16:11:49 [debug] 3557#0: *1 http finalize request: 0, "/favicon.ico?" a:1, c:1
2015/07/31 16:11:49 [debug] 3557#0: *1 set http keepalive handler
2015/07/31 16:11:49 [debug] 3557#0: *1 http close request
2015/07/31 16:11:49 [debug] 3557#0: *1 http log handler
2015/07/31 16:11:49 [debug] 3557#0: *1 free: 0000000000EF06A0
2015/07/31 16:11:49 [debug] 3557#0: *1 free: 0000000000000000
2015/07/31 16:11:49 [debug] 3557#0: *1 free: 0000000000F03B20, unused: 8
2015/07/31 16:11:49 [debug] 3557#0: *1 free: 0000000000EF6A40, unused: 2156
2015/07/31 16:11:49 [debug] 3557#0: *1 free: 0000000000F09E70
2015/07/31 16:11:49 [debug] 3557#0: *1 hc free: 0000000000000000 0
2015/07/31 16:11:49 [debug] 3557#0: *1 hc busy: 0000000000000000 0
2015/07/31 16:11:49 [debug] 3557#0: *1 reusable connection: 1
2015/07/31 16:11:49 [debug] 3557#0: *1 event timer add: 14: 65000:1438355574073
2015/07/31 16:11:49 [debug] 3557#0: *1 post event 0000000000F4A118
2015/07/31 16:11:49 [debug] 3557#0: *1 delete posted event 0000000000F4A118
2015/07/31 16:11:49 [debug] 3557#0: *1 http keepalive handler
2015/07/31 16:11:49 [debug] 3557#0: *1 malloc: 0000000000F09E70:1024
2015/07/31 16:11:49 [debug] 3557#0: *1 recv: fd:14 -1 of 1024
2015/07/31 16:11:49 [debug] 3557#0: *1 recv() not ready (11: Resource temporarily unavailable)
2015/07/31 16:11:49 [debug] 3557#0: *1 free: 0000000000F09E70

恩,我现在觉得自己像个十足的白痴!在我的配置中,我有:

location ~ \.cgi$ {
    gzip off;
    include /etc/nginx/fastcgi_params;
    fastcgi_pass unix:/var/run/fcgiwrap.socket;
    fastcgi_index index.cgi;
    fastcgi_param SCRIPT_FILENAME /srv/www/site.net/www/cgi-bin$fastcgi_script_name;
}
但是,该脚本文件名是错误的…应该是:

location ~ \.cgi$ {
    gzip off;
    include /etc/nginx/fastcgi_params;
    fastcgi_pass unix:/var/run/fcgiwrap.socket;
    fastcgi_index index.cgi;
    fastcgi_param SCRIPT_FILENAME /srv/www/site.net/www/$fastcgi_script_name;
}

(注意第二行到最后一行缺少的/cgi-bin)。当你能看到它时,它是如此简单!我只是想分享它,希望它能在将来的某个时候帮助其他人。Duh!

403是一个“禁止”(权限)错误代码。你的.cgi文件有可执行权限吗?@mob-是:)它的755,正确的perl路径,等非常基本的“你好世界”脚本。我已经在上面更新了域的错误日志中显示的错误,并且nginx用户可以读取和执行cgi文件的每个父目录?@mob-从/srv/www及以上的所有内容都是www数据:www数据/srv/www&/srv是根目录:root@mob-当设置为
debug
时,我刚刚从错误日志中输入了“debug”。但不确定它是否泄露了什么。我还比较了我的/etc/init.d/fcgiwrap文件,以防有什么大的不同——但似乎没有
location ~ \.cgi$ {
    gzip off;
    include /etc/nginx/fastcgi_params;
    fastcgi_pass unix:/var/run/fcgiwrap.socket;
    fastcgi_index index.cgi;
    fastcgi_param SCRIPT_FILENAME /srv/www/site.net/www/$fastcgi_script_name;
}