vhost nginx:未指定输入文件

vhost nginx:未指定输入文件,nginx,silex,Nginx,Silex,我正在尝试使用Silex和Nginx构建网页,但服务器定义中可能有错误,因为当我尝试访问它时,会出现以下错误: No input file specified. 我的服务器定义如下: server { listen [::]:80; server_name comparer.com; root /var/www/comparer.com/web/public; index index.php; #site root is redirected to t

我正在尝试使用Silex和Nginx构建网页,但服务器定义中可能有错误,因为当我尝试访问它时,会出现以下错误:

No input file specified.
我的服务器定义如下:

server {
    listen [::]:80;
    server_name comparer.com;
    root /var/www/comparer.com/web/public;
    index index.php;

    #site root is redirected to the app boot script
    location = / {
        try_files @site @site;
    }

    #all other locations try other files first and go to our front controller if none of them exists
    location / {
        try_files $uri $uri/ @site;
    }

    #return 404 for all php files as we do have a front controller
    location ~ \.php$ {
        return 404;
    }

    location @site {
        fastcgi_pass   unix:/var/run/php5-fpm.sock;
        fastcgi_param  SCRIPT_FILENAME  $document_root/index.php;
        include fastcgi_params;
    }
}
我尝试过不同的配置,但任何配置都有效


为了更安全,我想将index.php放在公用文件夹中,但我不知道Silex是否允许我这样做。

您的配置看起来不错。您现在在/var/www/comparer.com/web/public中有index.php吗

至于Silex约定,它们不涉及公共文件夹,也可以尝试
root/var/www/comparer.com/web


谢谢Aleksey,过了一会儿我发现我有另一个配置文件,所以我编辑了错误的配置。