My_webapp internal links fail

When uploading a flat file CMS (tried Kirby and Grav and Pico CMS) to webapp folder, nginx does not follow their link structure. For example, Kirby displays the UI, but fails to fetch images, and any click on a link results in 404 not found. Grav goes straight to 404 (caused by initial admin panel redirection).
I actually need only one CMS, but wanted to make sure that the problem is not in CMS but somewhere in my Yunohost/webapp.
Do I have to do some extra Ngnix config? Why could this be happening?

My YunoHost server

Hardware: Old laptop or computer
YunoHost version: 11.2.9.1
I have access to my server : Through SSH
If your request is related to an app, specify its name and version: my_webapp__2 1.0~ynh15

Can’t be sure without more accurate details on the exact structure of the URL you mention, but to me that sound like you need to configure what’s the root of the application inside the application (i’m assuming you installed your app on a subpath rather than a dedicated domain)

It’s probably an ownership problem. Uploaded files must have the correct owner like this
my_webapp__4 www-data
If you have more than one custom web app, you’ll have them numbered “__3”

It can be a nginx.conf to add, perhaps you can try add this. not sure but for a wordpress cms it works.

    if (!-e $request_filename)
     {
     rewrite ^(.*)$ /index.php?q=$1 last;
     

on this part

location __PATH__/ {

    # Path to source
    alias __INSTALL_DIR__/www/;

    # Default indexes and catch-all
    index index.html index.php;
    try_files $uri $uri/ __PATH__/index.php?$args;

    # Remove index.php from URL needed on some cms
    if (!-e $request_filename)
     {
     rewrite ^(.*)$ /index.php?q=$1 last;
     }

    # Prevent useless logs
    location = __PATH__/favicon.ico {
        log_not_found off;
        access_log off;
    }
1 Like

Thank you! It took some time for me to understand the difference between PATH and INSTALL_DIR, but it appears to work. Path is basically / in my case, because I used a subdomain for my_webapp installation.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.