我在Centos 7上使用php-fpm 7和SlimFramework 3.0,nginx设置了一个Slim应用程序。这是我的配置:
location /projects/ {
root /var/www/html;
rewrite index.php/(.*)$ index.php?url=$1 last;
index index.html $yii_bootstrap;
try_files $uri $uri/ /$yii_bootstrap?$args /index.php$is_args$args;
}
location ~ \.php{
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass php-fpm;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
include fastcgi_params;
}
和
upstream php-fpm {
#server 127.0.0.1:9000;
server unix:/run/php-fpm/www.sock;
}
然而,它无法正常工作,并为任何路线返回404。我的测试路线是:
$app = new \Slim\App();
$app->get('/cc', function ($request, $response, $args) {
$response->write("dcmmm");
return $response;
});