Troubles to have Nextcloudpi working behind Haproxy

Hello,

I have a RPi 4 with up to date Raspbian image, hosting a webapp installed on Nginx (which cannot be migrated to Apache).
After installing Nextcloudpi via the script dedicated to Debian, Apache cannot start. So far I understand that this is due to the fact it tries to listen the same ports than running Nginx.

In order to have both webservers run simulteneously I tried to follow this tutorial, and place them both behind Haproxy, attributing 127.0.0.1 to Nginx et 127.0.0.2 to Apache (as in the tutorial).
I followed the tutorial until the end of section “How to Forward Client’s IP address to Backend” (i.e. before generating new certificates). From there, Nginx, Apache and Haproxy run simultenously. However, nothing can be accessed (PR_END_OF_FILE_ERROR) - neither Nginx app which was working previously, nor NCP/NC.

At the moment I do not have a domain name and i would like to set everything to be accessed from local network. Ideally I would run Nginx app from “nginxws.local” and Apache apps (NCP) from “apachews.local”.

  1. Is my issue due to incompatible certificates with the changes made to Apache & Nginx configuration following the tutorial?
    I am not comfortable with the certificate generation part. I do not have DNS info like in the tutorial and I suppose new generated certificates would conflict with the ones NCP installation created. I would appreciate any clue here.

  2. Given I have no domain name, SSL SNI request in Haproxy config file should point on names defined in my host file ?
    My /etc/hosts file looks like:

127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

127.0.0.1 nginxws
127.0.0.2 apachews

  1. Why was it discouraged to use Haproxy on the same machine than the webserver it points to on this forum ?

EDIT: FYI I cross-posted this issue in slightly different terms on the community forum of website hosting the tutorial I followed.