Since this has turned to probably be a recent Webmin bug, I'm moving the posted data from the forums to this issue. This has been tested on two different servers (running Ubuntu and Debian), with the same results.
When creating Nginx virtual servers with Virtualmin, until recently it worked well (last time here on 2016-08-07), for example automatically adding an init file such as /etc/init.d/php-fcgi-example-com. This can also be seen at Webmin > System > Bootup and Shutdown.
However, after adding today (2016-08-12) two new virtual servers or domains, in both cases Virtualmin/Webmin didn't create the init file at /etc/init.d/. Therefore, after initially running well for a while, then -when rebooting the Ubuntu server- while the old Nginx virtual servers are still working OK thanks to their init files, the new ones on the same server are not restarted because of the lack of those init files, and just give a 502 Bad Gateway error.
This first server got a recent Webmin update from 1.801 to 1.810. Webmin > System > Software Packages says the installed version of the Virtualmin module for Nginx Webserver is: webmin-virtualmin-nginx 1.8.
After additional testing on a different server (Debian on Linode), this appears to probably be a recent bug, appeared a few days ago in Webmin 1.810 (about 2016-08-09).
The three tests used installations of three Webmin versions on the server, an old one, the recent one, and the current one. The following has happened when creating Nginx virtual servers (in the three cases with the same version of the Virtualmin module, webmin-virtualmin-nginx 1.8) :
- Webmin 1.760 -> The init file for the new Nginx virtual servers (/etc/init.d/php-fcgi-example-com) is automatically created. => OK
- Webmin 1.801 -> The init file for the new Nginx virtual servers is automatically created as well. => OK
- Webmin 1.810 -> The init file for the new Nginx virtual servers is not created. => Probably a very recent bug (about 2016-08-09).
The new virtual servers work well at first. This bug is only noticed after rebooting the server, when Nginx is restarted for the old virtual servers but not for the new ones, and the users get the 502 Bad Gateway errors for the new virtual servers.
If you have an idea for Virtualmin setting the init files when creating virtual servers (Nginx PHP fcgi), like it did before Webmin 1.810, I can help testing possible solutions on a local dev server. Thank you very much.
Comments
Submitted by jg on Fri, 08/12/2016 - 19:10 Comment #1
Submitted by jg on Fri, 08/19/2016 - 06:36 Comment #2
Of course, a workaround is to create by hand the missing init file, to keep the websites working until this bug is fixed. It's what I've done, and verified that everything works well with this temporary workaround.
An existing init file, created by a previous bug-free Webmin version, can be copied and customized by sudo or the root user for the new virtual servers, by searching and replacing the domain, user, and number of the socket folder.
For example, for a new virtual server "dev.example.com", this number can be seen in Webmin > Servers > Nginx Webserver > Edit Configuration Files > /etc/nginx/sites-available/dev.example.com.
If no old init file is available for copy and search/replace, the following is an example of a "/etc/init.d/php-fcgi-dev-example-com" init file (with domain "dev.example.com", user "dev", socket file "/var/php-nginx/111111111111111.sock/socket"):
(Updated using blockcode tag to prevent broken lines in code; see also the post below about /srv/www, /home, /var/www...).
Submitted by jg on Fri, 08/12/2016 - 20:55 Comment #3
To start the Nginx PHP fcgi virtual server for the new domain, now and on boot, with the recovered init file:
Webmin > System > Bootup and Shutdown > [X] php-fcgi-dev-example-com > Start Now and On Boot
Submitted by jg on Sat, 08/13/2016 - 05:47 Comment #4
About the temporary workaround, another change probably needed for the init file is \/srv\/www (that is, the FHS standard folder /srv/www for websites), which in most cases can be \/home (the Virtualmin default /home), or \/var\/www (the frequently used /var/www), etc.
Submitted by jg on Mon, 08/15/2016 - 07:05 Comment #5
Please, is there anything I can try to help fix this? As I said, I have a local dev server ready to test possible solutions.
As explained, Nginx virtual servers created after the last Webmin update (1.810) work well at first, but stop working after rebooting the server, because of lack of init file for the virtual server. Therefore, users will start noticing this only after a next server reboot.
And then, how users will repair their virtual servers? Is there a way to generate the init file for an already live virtual server, apart from laboriously by hand for each domain like in the temporary workaround? I would like to try any possible way. Thank you.
Submitted by andreychek on Mon, 08/15/2016 - 09:28 Comment #6
Sorry for the delay, we'll get back with you shortly.
What's the output of these two commands:
rpm -qa | grep webmin
rpm -qa | grep wbm
Submitted by jg on Mon, 08/15/2016 - 12:52 Comment #7
They give no output. I think I have only deb packages installed, not rpm. Using instead dpkg commands:
dpkg-query -l 'webmin'
dpkg -l | grep 'webmin'
These packages are results for 'webmin'. For 'wbm' there are no results.
There are similar results using: Webmin > System > Software Packages > Search For Package
Submitted by jg on Thu, 08/18/2016 - 08:12 Comment #8
To reproduce this, on a Nginx test server, just create a new virtual server with Virtualmin and the latest Webmin 1.810. And verify if the init file /etc/init.d/php-fcgi-example-com is created or not for the new domain. It was not with two different servers and this version of Webmin, as explained.
Submitted by irieyuusuke on Mon, 08/22/2016 - 10:33 Comment #9
I have same issue.
My package are below.
CentOS 6
Is this going to be fixed soon? The temporary workaround doesn't work either. It says,
php-fcgi-domain-com No such a file or directory
Of course I replace domain with my domain name. I can edit file from putty but Virtualmin says it doesn't exist.
Please fix this soon.
Thanks!
Submitted by kindnation on Wed, 08/31/2016 - 04:15 Comment #11
The PHP-FCGI init scripts aren't being created, e.g., /etc/init.d/php-fcgi-example-com
After a reboot, it will result in 502 Bad Gateway. The PHP-FastCGI Server is not being started for the domain. I really hope this gets fixed soon. I just posted about it before I saw this thread. I can confirm the bug.
Submitted by jg on Thu, 09/01/2016 - 19:02 Comment #12
This bug, as also reported by kindnation, is: php-fcgi init scripts no longer being created [#41875].
Submitted by firefoxchris on Fri, 09/02/2016 - 14:29 Comment #13
I can confirm the same issue on CentOS Linux release 7.2.1511 (Core) with nginx as reported by JG. Have also posted in above bug link, please post when a fix is released.
jg's workaround does not work on Ubuntu due to file path differences. I've posted tutorial for Ubuntu 14.04 and Ubuntu 16.04 here,
Virtualmin-Nginx 502 Bad Gateway Temporary Workaround Ubuntu
Hope this helps.
Submitted by firefoxchris on Wed, 09/07/2016 - 10:36 Comment #15
Any update? Please also see https://www.virtualmin.com/node/41875
Submitted by JamieCameron on Fri, 09/09/2016 - 00:38 Comment #16
Sorry for the delay - looking into this now
Submitted by mikt on Thu, 09/15/2016 - 10:01 Comment #17
Same issue here - Centos 6.8, Webmin 1.8.10 manually creating solved it
you can also destroy your existing file if you change the settings - so do an backup first
Submitted by firefoxchris on Thu, 09/22/2016 - 12:09 Comment #18
Hi @JamieCameron, do you know roughly when this might be fixed? Thank you for your help.
Submitted by JamieCameron on Thu, 09/22/2016 - 22:23 Comment #19
I expect to have a new Nginx plugin for Virtualmin out by the weekend
Submitted by kindnation on Thu, 09/29/2016 - 07:08 Comment #20
Hello Jamie,
I know you must be very busy, but this is a pretty critical bug that was introduced since the last webmin update.
Adding new virtual servers requires manually creating the PHP-FCGI scripts. I'm pretty sure everyone that is using Nginx with Virtualmin is having this issue. Could you please take a look at it and fix this asap?
Submitted by JamieCameron on Fri, 09/30/2016 - 17:41 Comment #21
Ok, I finally tracked down the cause of this - it was actually a Webmin bug. It will be fixed in the next release, but if you need something urgently you can see the specific code change here : https://github.com/webmin/webmin/commit/8ab998b1232fe7e6df04e389ca3b2198...
Submitted by jg on Sat, 10/01/2016 - 06:17 Comment #22
Jamie, thank you very much for the fix. So, those Nginx virtual servers created with the next Webmin version will be OK, like those created with versions previous to the current one (Webmin 1.810).
However, when users will restart their servers and will begin to see the 502 Bad Gateway errors instead of their sites (because new Nginx virtual servers are working well before the first server restart only), how to repair those Nginx virtual servers that are being created with the current Webmin version?:
Until the fix, another possibility is to use for now the previous Webmin version 1.801, which works great, instead of the current 1.810. For Debian, Ubuntu, etc.:
apt-get install webmin=1.801
This seems to work also for downgrades, and restarting just in case.
Thank you again.
Submitted by JamieCameron on Sat, 10/01/2016 - 16:53 Comment #23
The quick fix to repair existing domains (after Webmin 1.820 is out) will be to change the number of PHP child processes. This can be done from the command line, by running something like :
virtualmin modify-web --domain example.com --php-children 5
Submitted by jg on Mon, 10/03/2016 - 15:15 Comment #24
The new Webmin 1.820 is available now. I've tested it creating a new Nginx virtual server and restarting. It works well now, the init file is being created, and this bug seems fixed. Thank you!
Submitted by jg on Mon, 10/03/2016 - 15:17 Comment #25
Submitted by kindnation on Tue, 10/04/2016 - 09:55 Comment #26
I'm using Debian 8 and tried apt-get update && apt-get upgrade and I don't see 1.820 yet.
Submitted by jg on Tue, 10/04/2016 - 15:58 Comment #27
Kindnation, to have the new Webmin 1.820 available now, you can add the Webmin repository, following the section "Using the Webmin APT repository" (in the page Installing on Debian).
After that, you can do:
apt-get update
and
apt-cache policy webmin
to verify that the latest Webmin 1.820 has been added as available to install.
Submitted by JamieCameron on Tue, 10/04/2016 - 16:14 Comment #28
We haven't released it to the Virtualmin repos yet - I like to let it bake for a while for regular Webmin users first.