Estoy creando un proyecto con slim framework de php pero aveces me funciona, pero ahora creo que olvide como configurarlo pero ya configure mi nginx y tambien agregue un $app->setBasePath('/wsapis');
y tampoco tuve resultado alguno ¿como puedo hacer correr mi slim? gracias de antemano
este es mi nginx
server {
listen 80 default_server;
listen [::]:80 ipv6only=on default_server;
fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
root /var/www/html;
index index.php index.html index.htm index.nginx-debian.html;
server_name _;
location /wsapis {
try_files $uri $uri/ /wsapis/public/index.php$is_args$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
# try_files $uri =404;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
# # With php-fpm (or other unix sockets):
fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
# # With php-cgi (or other tcp sockets):
# fastcgi_pass 127.0.0.1:9000;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
location ~ \.(jpg|jpeg|gif|png|ico|css|js)$ {
access_log off;
expires 33d;
}
}
index.php
<?php
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
use Slim\Factory\AppFactory;
require __DIR__ . '/../vendor/autoload.php';
$app = AppFactory::create();
$app->setBasePath('/wsapis');
$app->get('/', function (Request $request, Response $response) {
$response->getBody()->write("Hello world!");
return $response;
});$app->addErrorMiddleware(true, true, true);
$app->run();