FastCGI/PHP-FPM
In order to use FastCGI with SVR.JS, you need to install GreenRhombus mod. Download the mod.
GreenRhombus notes
GreenRhombus’ path and FastCGI server address can be configured in greenrhombus-config.json file in the SVR.JS install directory.
Example configuration (with FastCGI server listening with port):
{
"path": "/fastcgi",
"host": "localhost",
"port": 7000
}
Example configuration (with FastCGI server listening on socket):
{
"path": "/fastcgi",
"socketPath": "/run/fastcgi.sock"
}
You can configure file extensions outside of path specified in greenrhombus-config.json file handled by GreenRhombus in greenrhombus-scriptexts.json file in SVR.JS installation directory like this:
[".php"]
GreenRhombus 1.1.0 and newer support multiple FastCGI servers. These versions of GreenRhombus can be configured to use multiple FastCGI servers like this:
{
"multiConfig": {
"example.com": {
"path": "/fastcgi",
"host": "localhost",
"port": 7000
},
"example.org": {
"path": "/fastcgiorg",
"host": "localhost",
"port": 7001
}
}
}
PHP-FPM
GreenRhombus supports running PHP files through PHP-FPM. If you want to use GreenRhombus only for PHP-FPM, configure greenrhombus-config.json like this (in this case we’re using socket in /run/php/php8.2-fpm.sock
; you can check it in PHP-FPM configuration file, e.g. /etc/php/8.2/fpm/pool.d/www.conf
; configure it without path property):
{
"socketPath": "/run/php/php8.2-fpm.sock"
}
And configure greenrhombus-scriptexts.json like this:
[".php"]
If using GreenRhombus 1.1.0 or newer, you can configure GreenRhombus to connect to multiple PHP-FPM instances like this:
{
"multiConfig": {
"example.com": {
"socketPath": "/run/php/php8.2-fpm.sock"
},
"example.org": {
"socketPath": "/run/php/php7.4-fpm.sock"
}
}
}
GreenRhombus 1.1.1 and newer support virtual host functionality based on switching web roots.
PHP-FPM may run on different user than SVR.JS web server, so you may need to set permissions for the user, which PHP-FPM runs on.
If you are using PHP-FPM only for SVR.JS, you can set the listen.owner and listen.group properties to svrjs in the PHP-FPM configuration file (e.g. /etc/php/8.2/fpm/pool.d/www.conf
).