Mounting the chat on nginx

One location block sends every address of the chat to its front controller.

nginx does not read .htaccess. One location block in your site’s configuration sends every address of the chat’s path to its front controller.

01 · The location block

Add this to the server block of your site, with your own PHP-FPM socket:

location ^~ /opensolr-chat/ {
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root/opensolr-chat/index.php;
    fastcgi_pass unix:/run/php/php8.3-fpm.sock;
    fastcgi_buffering off;
    gzip off;
}
  • ^~ /opensolr-chat/ takes every address under the path before any other location of your site can.
  • SCRIPT_FILENAME points at the front controller you copied in step 3 of Installing.
  • fastcgi_buffering off and gzip off let the answers reach the browser word by word.

If you mounted the chat on another path, use that path here and in base_path.

02 · Check and reload
sudo nginx -t && sudo systemctl reload nginx

Then https://your-site/opensolr-chat/widget.js must open as JavaScript.

When nginx is a reverse proxy in front of another web server, the settings are on Behind a proxy; more on buffering on Streaming through your server.

Install on your server

The Opensolr Chat Bot Client is open source and MIT licensed. Questions about your Opensolr account, index or plan go to opensolr.com/contact; questions about the client itself belong on GitHub.

Opensolr Chat Bot Documentation