Nginx 因 scgi_params 导致解析配置失败

Nginx 因 scgi_params 导致解析配置失败

我正在尝试安装 libtorrent、rtorrent 和 rutorrent。我正处于安装 rutorrent 的阶段,他们的 wiki 说我必须将此位置块放入我的配置文件中:

location /RPC2 {
    include scgi_params;
    scgi_pass unix:/tmp/rpc.sock;
}

这是我为该服务器配置的整个配置块:

server {
    listen 80;
    server_name localhost;
    access_log /home/whitey/sites/localhost/logs/access.log;
    error_log /home/whitey/sites/localhost/logs/error.log;
    root /home/whitey/sites/localhost/htdocs;
    index index.html index.php /index.php;

    location / { 

    }

    location ~ \.php$ {
        fastcgi_pass unix:/tmp/phpfpm.sock;
        fastcgi_param SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include fastcgi_params;
    }

    location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
        expires max;
    }

    location /RPC2 {
        include scgi_params;
        scgi_pass unix:/tmp/rpc.sock;
    }
}

当我重新启动 nginx 以使新配置生效时,出现此错误:

$ sudo /etc/init.d/nginx start
Starting nginx: nginx: [emerg] unknown directive "scgi_pass" in /etc/nginx/conf.d/localhost.conf:24
nginx: configuration file /etc/nginx/nginx.conf test failed

现在,nginx 的 SCGI 模块从 0.8.42 版本开始已经默认构建,这是输出nginx -vnginx version: nginx/1.1.19

任何帮助都将不胜感激,谢谢。

答案1

由于您的上述配置被放入/etc/nginx/conf.d/localhost.confscgi_params位于/etc/nginx,因此 Nginx 无法找到所包含的文件。

改用绝对路径:

location /RPC2 {
    include /etc/nginx/scgi_params;
    scgi_pass unix:/tmp/rpc.sock;
}

答案2

对我来说,是我的 nginx (~0.7 in squeeze) 没有自带 SCGI 模块

但是在 backports 中有一个 nginx-full 包可以做到!

我安装了它,现在它启动正常

http://wiki.debian.org/Nginx

http://backports-master.debian.org/Instructions/

相关内容