Help with getting the right Nginx.php-fpm configs for external webapp

Hi,

I’m very interested in Sitebar Bookmark Server app that is much more advanced than the 2 Bookmark apps already in the YNH system. I tried placing this in the YNH Apps Request list, but I was unable to figure out how…

Separately, I believe the app should work straight out of the box if I can figure out the correct configs for Nginx/php-fpm. The maintainer already has a Docker image with Nginx site.conf ready to go.

  • I created a php/7.4/fpm/pool.d/sitebar.conf as:
[sitebar]

user = www-data
group = www-data

chdir = /var/www/sitebar

listen = /var/run/php/php7.4-fpm-sitebar.sock
listen.owner = www-data
listen.group = www-data

pm = ondemand
pm.max_children = 12
pm.max_requests = 500
request_terminate_timeout = 1d

pm.process_idle_timeout = 10s
  • I created nginx/conf.d/mydomain.name.d/sitebar.conf as:
rewrite ^/sitebar$ /sitebar/ permanent;
location /sitebar/ {
    # Path to source
    alias /var/www/sitebar/ ;

    index index.php index.html index.htm;
    try_files $uri $uri/ /index.php?$query_string;
}
  
location ~ ^/sitebar/.php$ {
    try_files $uri = 404;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass unix:/var/run/php/php7.4-fpm-sitebar.sock;
    fastcgi_index index.php;
    include fastcgi_params;
    fastcgi_param REQUEST_URI $request_uri;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param PATH_INFO $fastcgi_path_info;
    fastcgi_read_timeout 300;
}

RESULT/BREAKAGE:
I go to https://mydomain.name/sitebar (I’m logged in as user to YNH) and the page flashes/refreshes and nothing! I’m still at the User Portal page. The Sitebar code is cloned with git, under /var/www/sitebar and ownership is www-data:www-data.

BRANCH: Testing/Bullseye
HARDWARE: On-Premise amd64

I’m willing to work & test suggestions to get this working, but unfortunately I know close to zero when it comes to PHP. Thank you for any suggestions.

Did you try to install the docker image and install a yunohost redirect app to the url of the container with nginx proxy pass?
I have installed cusdis (a commenting platform) using docker compose then I have installed a redirect app in yunohost to the ip:port of the container. I have set nginx proxy pass to all. It’s working fine since more than a month.

Hi, I try also have specific php configs for my_webapp.
I have try edit /etc/php/8.0/fpm/pool.d/my_webapp.conf (a wordpress) with values like:

[my_webapp]

user = my_webapp
group = my_webapp

chdir = /var/www/my_webapp

listen = /var/run/php/php8.0-fpm-my_webapp.sock
listen.owner = www-data
listen.group = www-data

pm = ondemand
pm.max_children = 16
pm.max_requests = 500
request_terminate_timeout = 360s


pm.process_idle_timeout = 10s

; Additional php.ini defines, specific to this pool of workers._RR

php_admin_value[upload_max_filesize] = 512M
php_admin_value[memory_limit] = 2048M
php_admin_value[post_max_size] = 512M
php_admin_value[upload_max_filesize] = 512M
php_admin_value[max_input_vars] = 2000000
php_admin_value[upload_tmp_dir] = /var/www/my_webapp/www/wp-content/tmp/

it seems working for now after restart php8.-fpm and nginx