Changing the PHP version breaks MyWebApp

Hello all,

I have noticed a strange behavior with the APP MyWebAPP.

My YunoHost server

Hardware: VPS bought online
YunoHost version: 11.2.10.1 (stable)
I have access to my server : Through SSH and through the webadmin
Are you in a special context or did you perform some particular tweaking on your YunoHost instance ? : NO
If yes, please explain: NO
If your request is related to an app, specify its name and version: mywebapp 1.0~ynh15

Description of my issue

Whenever I change the PHP version in the “My WebAPP configuration” settings (for example from 8.0 to 8.1), the file my_webapp.conf under /etc/nginx/conf.d/my-domain.com.d seems to be assembled incorrectly.

Before changing the PHP version, the file looks like this:



#sub_path_only rewrite ^/$ / permanent;
location / {

    # Path to source
    alias /var/www/my_webapp/www/;

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

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

    location = /robots.txt {
        allow all;
        log_not_found off;
        access_log off;
    }

    # Deny access to hidden files and directories
    location ~ ^/(.+/|)\.(?!well-known\/) {
        deny all;
    }

    include conf.d/my-domain.com.d/my_webapp.d/*.conf;

    # Include SSOWAT user panel.
    include conf.d/yunohost_panel.conf.inc;
}

After the change it looks like this:

 rewrite ^/$ // permanent;
location // {

    # Path to source
    alias /var/www/my_webapp/www/;

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

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

    location = //robots.txt {
        allow all;
        log_not_found off;
        access_log off;
    }

    # Deny access to hidden files and directories
    location ~ ^//(.+/|)\.(?!well-known\/) {
        deny all;
    }

    include conf.d/my-domain.com.d/my_webapp.d/*.conf;

    # Include SSOWAT user panel.
    include conf.d/yunohost_panel.conf.inc;
}

The diff-command shows:

< #sub_path_only rewrite ^/$ / permanent;
< location / {
---
>  rewrite ^/$ // permanent;
> location // {
<     try_files $uri $uri/ /index.php?$args;
---
>     try_files $uri $uri/ //index.php?$args;
<     location = /favicon.ico {
---
>     location = //favicon.ico {
<     location = /robots.txt {
---
>     location = //robots.txt {
<     location ~ ^/(.+/|)\.(?!well-known\/) {
---
>     location ~ ^//(.+/|)\.(?!well-known\/) {

If you now call up the website my-domain.com, an error message is displayed: “Error: Redirection error - An error occurred while connecting to my-domain.com. This problem can sometimes occur when cookies are disabled or rejected.” (Probably not the original wording in English - I had it translated :wink: )

If you save the file my_webapp.conf before changing the PHP version, copy it back after the change and restart the nginx, then everything is ok.

Maybe it will help someone else who stumbles across the problem …

Best regards
Tinder

1 Like

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