Jitsi has issues with enabling PHP in nginx

Has anyone successfully configured PHP to work with nginx installed and configured by jitsi meet quick install?

when I try it the normal way its done with nginx, it fails to load jitsi meetings with some proxy errors on nginx logs

and when I try to enable php for a subdirectory to work around this problem, the meetings fail to load and always redirect back to home page

1 Like

Nobody to answer this? installing jitsi alters the nginx conf so that other stuff becomes unusable; any solution?

anyone? @damencho @saghul

Hi Techie,
For running default JItsi-Meet installation and PHP with NGINX , you find the simple way by enabling PHP on a directory location.
We’re running PHP and JItsi-meet in same Nginx for many years and it works fine.
You should have some error in your Nginx config.
Could you post it here ?
Regards,
Damien

I tried the same, having php enabled for a subdirectory

location ~ .php$ {
fastcgi_split_path_info ^(.+.php)(/.+)$;
include snippets/fastcgi-php.conf;
fastcgi_read_timeout 240;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
}

I have added the above block to the end of the SSL server block
server {
listen 4444 ssl http2;
listen [::]:4444 ssl http2;

when I do this, I can access php files under the /app directory but the jitsi conferencing goes for a toss and I see proxy connect errors in nginx logs

my usecase is as follows

  1. I dont want the jitsi homepage so I want index.html in /usr/share/jitsi-meet to redirect me to /app where the index.php gets processed and used by the customer
  2. apart from this when the url is invoked like https://example.com/meetingid I want it to go to the jitsi meeting as usual;

I have been struggling with this for more than a week without any resolution;

this nginx is installed by jitsi itself and its a basic jitsi installation done using the quick install method;

I have separately installed php7.4 fpm and its necessary components on my own;

Would it be possible to share a working config?

I have shared some more details; please help

Hi Techie,
Do something similar to your use-case, we have done a little workaround in the default config.

First add a symbolic link in default jitsi-meet web root path to the php app :

  • ln -s /var/www/html/app /usr/share/jitsi-meet/app

An add this in nginx config :
location =/ {
return 301 https://$host/app$request_uri;
}
location ~ /app/ {
try_files $uri /app/index.php$1?$args;
}

If you use some PHP framework, you may need to add some specific redirection or rewrite in your nginx configuration.
Regards,
Damien

The moment I do something like this, meetings no longer work and everything redirects to the app/index.php page; not sure how to solve it; I am just using PHF FPM and no special framework;

it could be just as simple as telling nginx that if there is a valid php file in the path, parse it or if there is just the base url typed, take the visitor to app/index.php and for any other string treat it as a meeting name; but I am not really able to figure out how to get this simple config working amidst all the rules that jitsi adds;

any help?

Has anyone been able to figure this out yet? Adding the standard PHP snippet to the server blocs doesn’t do anything

   location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
   }

Yes. This is definitely possible. I just did it with the latest Jitis Meet, PHP fastcgi on Nginx. You may need to make sure other directives in your conf file are not taking priority.

By the way, there is nothing special about Nginx when installed with Jitsi. It’s all in the conf file.

Here is an example /etc/nginx/sites-available/meet.domain.com.conf :

server 
{
  listen 127.0.0.1:8080;
  server_name meet.domain.com;

  . . .

  location ~ [^/]\.php(/|$) 
  {
    fastcgi_pass unix:/run/php/php7.2-fpm.sock;
    include snippets/fastcgi-php.conf;
  }
}

If I remember correctly, there was a try try_files directive in the conf file after the Jitsi install. I took out and made some other changes for my implementation.

Also, you will probably also want to increase pm.max_children from 5 (in your /etc/php/7.2/fpm/pool.d/www.conf.)