虚拟主机的nginx:没有输入文件中指定
问题描述:
我试图建立使用的Silex和Nginx的网页,但我可能有一些错误的服务器定义,因为当我尝试访问它出现以下错误:虚拟主机的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
。
感谢阿列克谢,一段时间后,我发现,我有另外的配置文件,所以我编辑了错误的配置。 – M0N0NE 2014-09-14 11:17:28