virtualmin / virtualmin-nginx

Virtualmin plugin to allow use of nginx web server for virtual domain hosting
GNU General Public License v3.0
36 stars 13 forks source link

FPM Socket Issue in Nginx Config when Cloning Virtual Server #57

Closed bobbyschultz closed 1 year ago

bobbyschultz commented 1 year ago

Webmin version 2.021 Usermin version 1.861 Virtualmin version 7.7 Nginx version: 1.18.0 PHP version: 8.1

During the Clone Virtual Server process, the following error is thrown after "Applying Nginx Configuration": configuration is invalid : nginx: [emerg] no path in the unix domain socket in upstream "unix:" in /etc/nginx/sites-enabled/xxxx.conf:33 nginx: configuration file /etc/nginx/nginx.conf test failed

Restarting Nginx manually results in a failure to start. Setting the PHP mode to FPM on the cloned virtual server fixes the issue.

It looks like this happens when a virtual server with the PHP mode set to FPM is cloned. The new virtual server's PHP mode is set to FCGId by default. The resulting virtual server's Nginx config is missing the reference to the FPM socket file in the "fastcgi_pass" directive. The socket file is created in /var/php-fpm/ but the reference is missing in the Nginx config.

Once the virtual server is put into FPM mode for the first time the "fastcgi_pass" directive is fixed, but until then, Nginx will fail to start. Capture PHP Options Virtualhost Config V Host Config Corrected

jcameron commented 1 year ago

Ok I see the cause of this - it will be fixed in the next Nginx module release.