Hi !
I have developed an API with slim 4 in local environment (apache) following the Odan tutorial : https://odan.github.io/2019/11/05/slim4-tutorial.html
But now i tried to delpoy it in a self hosted server runnig with Yunohost. Yunohost works with Nginx. And i tried to install my API in the custom_webapp
application.
So it does not work.
My url app is : mydomain/pvapp/
This url work well : i have an 404 error generated by slim and it’s normal, this route is not set.
But for all the others route nginx don’t works and says to me “Redirection error: unmanaged domain”
My route are in https://mydomain/pvapp/api/v1/theroute
there is my nginx config (stored in : /etc/nginx/conf.d/mydomain.d/my_webapp.conf
)
rewrite ^/pvapp$ /pvapp/ permanent;
location /pvapp/ {
# Path to source
alias /var/www/my_webapp/www/public/;
# Force usage of https
if ($scheme = http) {
rewrite ^ https://$server_name$request_uri? permanent;
}
# Default indexes and catch-all
index index.html index.php;
try_files $uri $uri/ /pvapp/index.php?$args;
# Prevent useless logs
location = /pvapp/favicon.ico {
log_not_found off;
access_log off;
}
location = /pvapp/robots.txt {
allow all;
log_not_found off;
access_log off;
}
# Deny access to hidden files and directories
location ~ ^/pvapp/(.+/|)\.(?!well-known\/) {
deny all;
}
# Execute and serve PHP files
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_pass unix:/var/run/php/php7.4-fpm-my_webapp.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param REMOTE_USER $remote_user;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $request_filename;
}
# Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc;
}
it’s different of the requierd config of the doc : https://www.slimframework.com/docs/v4/start/web-servers.html#nginx-configuration
But i have tried lots of various adaptations and nothing works.
My API architecture :
My routes.php :
is some knows how to set up my my_webapp.conf
nginx config file to make it right ?
Thx a lot !
(and sorry for my bad english)
LaBaude