Nginx configuration and issue redirections on Garradin

Hello,
I try maintain the Garradin_ynh app.
Since an upgrade version for Garradin_ynh, there is an issue with the links created on the public page. It must be a problem with the nginx.conf but I haven’t found what’s going wrong.
This issue is explain here : https://github.com/YunoHost-Apps/garradin_ynh/issues/24
The links works for the wiki when they are private, it is possible to edit other public pages in the wiki, but the links don’t works…
After discussion with the maintainer of Garradin, it seems that the urls must be found in /var/www/garradin/www/_route.php. I have try to add these lines on the config:

index index.php index.html;
try_files $uri $uri/ /_route.php;

But it did not resolve the matter… and I am not an expert.

Does somebody can help me resolve this issue ?
I am working in the testing branch of this app, here is the link to the file nginx.conf:

https://github.com/YunoHost-Apps/garradin_ynh/blob/testing/conf/nginx.conf

I have seen a suggestion to add this in the nginx.conf:

index index.php index.html;
try_files $uri $uri/ /_route.php?$query_args;

But, it did not work, I tried on local machine, it brokes nginx…

I think you need to add __PATH__

Really-quick-non-tested-trial :
https://github.com/ericgaspar/garradin_ynh/blob/NGINX/conf/nginx.conf

2 Likes

Yes ! You found it @ericg ! I have tested, and it works ! thank you so much ! <3

Do you think I can merge the Pull Request #27 ? I think it is possible… Just a detail, as it is write with php7.3, perhaps it is not a good idea if some users are still using a old Yunohost with Debian Stretch ?
I have try with jenkins, it seems all right:

Ok, I have finally pushed the PR. I hope this will resolve the issues… I think so !

Hello,
since the new releases of Garradin v1.0.* we have adopted @ericg suggestion to resolve the URLs added in the public site, and it works !
But, I have not realize the mistakes with URLs when you add a new accounting entry, this issue is now open: url path issue when saving new accounting entry · Issue #37 · YunoHost-Apps/garradin_ynh · GitHub
I am sure it is a line or parameter to fix in the nginx.conf but it is hard for me to found…
Also, I suggest to use the branch subpath_correction on the source project ti try debug this issue…

Bonjour,
besoin d’aide encore avec la configuration nginx.conf pour résoudre une erreur avec les nouvelles versions à venir de Garradin.
Nous avons mis en place une branche git 1.1 pour tester cette mise ç jour qui à besoin de php7.4.
Les scripts install et upgrade fonctionne, mise à part une redirection cassée qui renvoi une erreur 403.

Encore un soucis avec la configuration de nginx:
Quand je veux aller dans la page /path/admin/config/ il ne trouve pas le bon chemin, mais si je tape /parh/admin/config/index.php, ça marche.
Pareil pour d’autres adresses comme par exemple pour les sauvegardes, il cherche /path/admin/config/backup/ et renvoi erreur 403 mais si j’ajoute /path/admin/config/backup/index.php ça marche…

bref toutes les adresses suite à /garradin/admin/config/

On a du faire des configurations un peu particulières la dernière fois pour que les redirections des pages web publiques fonctionnent !

if ($scheme = http) {
    rewrite ^ https://$server_name$request_uri? permanent;
  }

  index index.php /_route.php;
  try_files $uri $uri/ __PATH__/__PATH__/_route.php?$query_string;

  location ~ \.php$ {
        if (!-e $request_filename) {
            rewrite ^__PATH__/?(.*)$ __PATH__/_route.php?/$1 last;
            break;
        }
        fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.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;
  }

Mais là du coup, il manque une requête pour ces pages… Quelqu’un saurait me dire ?