我正在尝试使用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是否允许我这样做。
答案 0 :(得分:0)
您的配置看起来不错。你现在在/var/www/comparer.com/web/public中有index.php吗?
至于Silex惯例,他们对公共文件夹一无所知,也尝试root /var/www/comparer.com/web
。