502 Bad Gateway using nginx 1.10.3

Hello Virtualmin Team

I may have a problem. I have updated Webmin/Virtualmin today and it requested a reboot to install the new drivers. After the reboot I tried accessing my WordPress website and it gave me a 502 Bad Gateway. When I went to my nginx error log it gives me the following:

2017/12/19 21:38:58 [error] 1705#1705: *7916 connect() to unix:/var/php-nginx/151160929049397.sock/socket failed (11: Resource temporarily unavailable) while connecting to upstream, client: 185.188.204.6, server: example.co.za, request: "POST /xmlrpc.php HTTP/1.0", upstream: "fastcgi://unix:/var/php-nginx/151160929049397.sock/socket:", host: "xx.xxx.xx.xxx"

Afterwards I searched the web for a solution and found that it was an issue regarding the php-fcgi-example-co-za in my Bootup and Shutdown in Webmin. It starts at boot but it isn't running now. I am not sure what to do as it is not running every time I select and start it.

Regards

PresPhuture

Status: 
Closed (fixed)

Comments

PresPhuture's picture
Submitted by PresPhuture on Tue, 12/19/2017 - 13:52 Pro Licensee

Project: Virtualmin Virtual Servers » Webmin Core
Assigned: Unassigned »
PresPhuture's picture
Submitted by PresPhuture on Tue, 12/19/2017 - 13:54 Pro Licensee

Assigned: » Unassigned

If you SSH in as root and run /etc/init.d/php-fcgi-example-co-za start , what does it output?

PresPhuture's picture
Submitted by PresPhuture on Tue, 12/19/2017 - 16:23 Pro Licensee

Hi Jamie

The code didn't output anything however my site suddenly works. Thanks a million if that was the purpose.

Regards PresPhuture

PresPhuture's picture
Submitted by PresPhuture on Tue, 12/19/2017 - 16:30 Pro Licensee

Hi Jamie

Now when I try to access the site. It takes longer to load to load a page.

PresPhuture's picture
Submitted by PresPhuture on Tue, 12/19/2017 - 16:57 Pro Licensee

Hi

The 502 Bad Gateway is back again after the site was back online again. Opening a page took more than 5 minutes to load then when I tried to go back to homepage. The 502 message came back. I ran the code and this is what I receive:

root@portall:~# /etc/init.d/php-fcgi-portall-co-za start root@portall:~#

It looks like maybe the PHP FCGId server process crashed. Are there any messages in /var/log/messages that could be related? For example, is your system perhaps low on RAM?

PresPhuture's picture
Submitted by PresPhuture on Thu, 12/21/2017 - 05:36 Pro Licensee

Hi Jamie

I don't have a message folder in my /var/log/ entry. it says no such file or directory. Is there another log file that I need to view or another folder.

PresPhuture's picture
Submitted by PresPhuture on Thu, 12/21/2017 - 17:02 Pro Licensee

Hi Jamie

This is the php7.0-fpm.log file regarding the message you required after doing some research on the statement you said about PHP FCGI server process crashing. Hope this help

[10-Dec-2017 06:25:23] NOTICE: error log file re-opened [11-Dec-2017 20:52:57] WARNING: [pool www] child 1651 exited on signal 9 (SIGKILL) after 286009.883683 seconds from start [11-Dec-2017 20:52:58] NOTICE: [pool www] child 5412 started [11-Dec-2017 20:52:58] WARNING: [pool www] child 1652 exited on signal 9 (SIGKILL) after 286010.835538 seconds from start [11-Dec-2017 21:13:45] NOTICE: configuration file /etc/php/7.0/fpm/php-fpm.conf test is successful

[11-Dec-2017 21:13:45] NOTICE: fpm is running, pid 1728 [11-Dec-2017 21:13:45] NOTICE: ready to handle connections [11-Dec-2017 21:13:45] NOTICE: systemd monitor interval set to 10000ms [12-Dec-2017 16:51:41] NOTICE: Terminating ... [12-Dec-2017 16:51:41] NOTICE: exiting, bye-bye! [12-Dec-2017 16:52:21] NOTICE: configuration file /etc/php/7.0/fpm/php-fpm.conf test is successful

[12-Dec-2017 16:52:21] NOTICE: fpm is running, pid 1626 [12-Dec-2017 16:52:21] NOTICE: ready to handle connections [12-Dec-2017 16:52:21] NOTICE: systemd monitor interval set to 10000ms [14-Dec-2017 21:44:09] NOTICE: configuration file /etc/php/7.0/fpm/php-fpm.conf test is successful

[14-Dec-2017 21:44:09] NOTICE: fpm is running, pid 1661 [14-Dec-2017 21:44:09] NOTICE: ready to handle connections [14-Dec-2017 21:44:09] NOTICE: systemd monitor interval set to 10000ms [17-Dec-2017 20:36:07] WARNING: [pool www] child 1675 exited on signal 9 (SIGKILL) after 255117.290849 seconds from start [17-Dec-2017 20:36:11] NOTICE: [pool www] child 46063 started [17-Dec-2017 20:53:36] NOTICE: configuration file /etc/php/7.0/fpm/php-fpm.conf test is successful

[17-Dec-2017 20:53:36] NOTICE: fpm is running, pid 1668 [17-Dec-2017 20:53:36] NOTICE: ready to handle connections [17-Dec-2017 20:53:36] NOTICE: systemd monitor interval set to 10000ms

[18-Dec-2017 06:25:23] NOTICE: error log file re-opened [18-Dec-2017 20:46:26] NOTICE: configuration file /etc/php/7.0/fpm/php-fpm.conf test is successful

[18-Dec-2017 20:46:27] NOTICE: fpm is running, pid 1638 [18-Dec-2017 20:46:27] NOTICE: ready to handle connections [18-Dec-2017 20:46:27] NOTICE: systemd monitor interval set to 10000ms [19-Dec-2017 14:13:09] NOTICE: Terminating ... [19-Dec-2017 14:13:09] NOTICE: exiting, bye-bye! [19-Dec-2017 14:13:53] NOTICE: configuration file /etc/php/7.0/fpm/php-fpm.conf test is successful

[19-Dec-2017 14:13:54] NOTICE: fpm is running, pid 1666 [19-Dec-2017 14:13:54] NOTICE: ready to handle connections [19-Dec-2017 14:13:54] NOTICE: systemd monitor interval set to 10000ms [19-Dec-2017 20:29:42] NOTICE: Terminating ... [19-Dec-2017 20:29:43] NOTICE: exiting, bye-bye! [19-Dec-2017 20:30:53] NOTICE: configuration file /etc/php/7.0/fpm/php-fpm.conf test is successful

[19-Dec-2017 20:30:54] NOTICE: fpm is running, pid 1775 [19-Dec-2017 20:30:54] NOTICE: ready to handle connections [19-Dec-2017 20:30:54] NOTICE: systemd monitor interval set to 10000ms [20-Dec-2017 20:35:22] WARNING: [pool www] child 1778 exited on signal 9 (SIGKILL) after 86668.248676 seconds from start [20-Dec-2017 20:35:24] NOTICE: [pool www] child 48950 started [20-Dec-2017 20:35:25] WARNING: [pool www] child 1779 exited on signal 9 (SIGKILL) after 86671.576393 seconds from start [20-Dec-2017 20:35:28] NOTICE: [pool www] child 48954 started [20-Dec-2017 20:35:30] WARNING: [pool www] child 48950 exited on signal 9 (SIGKILL) after 7.266509 seconds from start [20-Dec-2017 20:35:30] NOTICE: [pool www] child 48958 started [20-Dec-2017 20:35:31] WARNING: [pool www] child 48954 exited on signal 9 (SIGKILL) after 3.498388 seconds from start [20-Dec-2017 20:35:31] NOTICE: [pool www] child 48960 started [20-Dec-2017 21:05:33] NOTICE: configuration file /etc/php/7.0/fpm/php-fpm.conf test is successful

[20-Dec-2017 21:05:33] NOTICE: fpm is running, pid 1720 [20-Dec-2017 21:05:33] NOTICE: ready to handle connections [20-Dec-2017 21:05:33] NOTICE: systemd monitor interval set to 10000ms

Regards

PresPhuture

It does look like the FPM process is being occasionally terminated. Are you sure you're system isn't low on RAM?

PresPhuture's picture
Submitted by PresPhuture on Mon, 12/25/2017 - 09:59 Pro Licensee

Merry Christmas.

I've asked my ISP to migrate my server from the small VPS with 1 gig RAM to a 2 gig RAM and they did. On virtualmin I use like about 65% of RAM for my server. Is that enough or do I still need more.

My server hardware is:

Intel Xeon E5 2.6GHZ processor

1 vCPU

2GB RAM

100GB HDD Space

2 GB should be enough.

PresPhuture's picture
Submitted by PresPhuture on Mon, 01/08/2018 - 08:00 Pro Licensee

Category: Bug report » Support request
PresPhuture's picture
Submitted by PresPhuture on Mon, 01/08/2018 - 08:07 Pro Licensee

Hi

I am still encounter an issue with my socket. It is now consuming my virtual memory. It is always on 100%. Here is the recent error I've received:

2018/01/08 13:02:57 [error] 1592#1592: *4017 FastCGI sent in stderr: "PHP Warning: Invalid argument supplied for foreach() in /home/portall/public_html/wp-admin/includes/plugin.php on line 1432" while reading response header from upstream, client: 105.15.24.33, server: portall.co.za, request: "GET /wp-admin/admin-ajax.php?postviews_id=174&action=postviews&_=1515409377037 HTTP/1.1", upstream: "fastcgi://unix:/var/php-nginx/151160929049397.sock/socket:", host: "portall.co.za", referrer: "https://portall.co.za/" 2018/01/08 13:03:50 [error] 1592#1592: *4017 FastCGI sent in stderr: "PHP Warning: Division by zero in /home/portall/public_html/wp-content/plugins/super-socializer/super_socializer.php on line 903" while reading response header from upstream, client: 105.15.24.33, server: portall.co.za, request: "GET /john-doe/profile/ HTTP/1.1", upstream: "fastcgi://unix:/var/php-nginx/151160929049397.sock/socket:", host: "portall.co.za", referrer: "https://portall.co.za/" 2018/01/08 13:03:55 [error] 1592#1592: *4017 FastCGI sent in stderr: "PHP Warning: Invalid argument supplied for foreach() in /home/portall/public_html/wp-admin/includes/plugin.php on line 1432" while reading response header from upstream, client: 105.15.24.33, server: portall.co.za, request: "GET /wp-admin/admin-ajax.php?postviews_id=0&action=postviews&_=1515409437019 HTTP/1.1", upstream: "fastcgi://unix:/var/php-nginx/151160929049397.sock/socket:", host: "portall.co.za", referrer: "https://portall.co.za/john-doe/profile/" 2018/01/08 13:04:03 [error] 1592#1592: *4017 FastCGI sent in stderr: "PHP Warning: Division by zero in /home/portall/public_html/wp-content/plugins/super-socializer/super_socializer.php on line 903" while reading response header from upstream, client: 105.15.24.33, server: portall.co.za, request: "GET /john-doe/settings/ HTTP/1.1", upstream: "fastcgi://unix:/var/php-nginx/151160929049397.sock/socket:", host: "portall.co.za", referrer: "https://portall.co.za/john-doe/profile/" 2018/01/08 13:04:10 [error] 1592#1592: *4017 FastCGI sent in stderr: "PHP Warning: Invalid argument supplied for foreach() in /home/portall/public_html/wp-admin/includes/plugin.php on line 1432" while reading response header from upstream, client: 105.15.24.33, server: portall.co.za, request: "GET /wp-admin/admin-ajax.php?postviews_id=0&action=postviews&_=1515409450306 HTTP/1.1", upstream: "fastcgi://unix:/var/php-nginx/151160929049397.sock/socket:", host: "portall.co.za", referrer: "https://portall.co.za/john-doe/settings/" 2018/01/08 13:04:22 [error] 1592#1592: *4017 FastCGI sent in stderr: "PHP Warning: Division by zero in /home/portall/public_html/wp-content/plugins/super-socializer/super_socializer.php on line 903" while reading response header from upstream, client: 105.15.24.33, server: portall.co.za, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/php-nginx/151160929049397.sock/socket:", host: "portall.co.za", referrer: "https://portall.co.za/john-doe/settings/" 2018/01/08 13:04:29 [error] 1592#1592: *4017 FastCGI sent in stderr: "PHP Warning: Invalid argument supplied for foreach() in /home/portall/public_html/wp-admin/includes/plugin.php on line 1432" while reading response header from upstream, client: 105.15.24.33, server: portall.co.za, request: "GET /wp-admin/admin-ajax.php?postviews_id=174&action=postviews&_=1515409469535 HTTP/1.1", upstream: "fastcgi://unix:/var/php-nginx/151160929049397.sock/socket:", host: "portall.co.za", referrer: "https://portall.co.za/" 2018/01/08 13:07:00 [error] 1592#1592: *4075 FastCGI sent in stderr: "PHP Warning: Division by zero in /home/portall/public_html/wp-content/plugins/super-socializer/super_socializer.php on line 903" while reading response header from upstream, client: 105.15.24.33, server: portall.co.za, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/php-nginx/151160929049397.sock/socket:", host: "portall.co.za", referrer: "https://portall.co.za/" 2018/01/08 13:07:06 [error] 1592#1592: *4075 FastCGI sent in stderr: "PHP Warning: Invalid argument supplied for foreach() in /home/portall/public_html/wp-admin/includes/plugin.php on line 1432" while reading response header from upstream, client: 105.15.24.33, server: portall.co.za, request: "GET /wp-admin/admin-ajax.php?postviews_id=174&action=postviews&_=1515409626889 HTTP/1.1", upstream: "fastcgi://unix:/var/php-nginx/151160929049397.sock/socket:", host: "portall.co.za", referrer: "https://portall.co.za/" 2018/01/08 14:05:23 [error] 1592#1592: *4093 FastCGI sent in stderr: "PHP Warning: Division by zero in /home/portall/public_html/wp-content/plugins/super-socializer/super_socializer.php on line 903" while reading response header from upstream, client: 139.162.106.181, server: portall.co.za, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/php-nginx/151160929049397.sock/socket:", host: "portall.co.za", referrer: "https://41.185.95.103:443/" 2018/01/08 14:09:51 [error] 1592#1592: *4095 FastCGI sent in stderr: "PHP Warning: Division by zero in /home/portall/public_html/wp-content/plugins/super-socializer/super_socializer.php on line 903" while reading response header from upstream, client: 66.249.73.192, server: portall.co.za, request: "GET /janedoe/followers/ HTTP/1.1", upstream: "fastcgi://unix:/var/php-nginx/151160929049397.sock/socket:", host: "portall.co.za" 2018/01/08 15:25:38 [error] 1592#1592: *4099 FastCGI sent in stderr: "PHP Warning: Division by zero in /home/portall/public_html/wp-content/plugins/super-socializer/super_socializer.php on line 903" while reading response header from upstream, client: 66.249.73.196, server: portall.co.za, request: "GET /tokotoko/followers/ HTTP/1.1", upstream: "fastcgi://unix:/var/php-nginx/151160929049397.sock/socket:", host: "portall.co.za" 2018/01/08 15:34:26 [error] 1592#1592: *4112 FastCGI sent in stderr: "PHP Warning: Division by zero in /home/portall/public_html/wp-content/plugins/super-socializer/super_socializer.php on line 903" while reading response header from upstream, client: 105.15.24.33, server: portall.co.za, request: "GET /wp-login.php?redirect_to=https%3A%2F%2Fwww.portall.co.za%2Fwp-admin%2F&reauth=1 HTTP/1.1", upstream: "fastcgi://unix:/var/php-nginx/151160929049397.sock/socket:", host: "portall.co.za" 2018/01/08 15:34:38 [error] 1592#1592: *4116 FastCGI sent in stderr: "PHP Warning: Division by zero in /home/portall/public_html/wp-content/plugins/super-socializer/super_socializer.php on line 903" while reading response header from upstream, client: 105.15.24.33, server: portall.co.za, request: "POST /wp-login.php HTTP/1.1", upstream: "fastcgi://unix:/var/php-nginx/151160929049397.sock/socket:", host: "portall.co.za", referrer: "https://portall.co.za/wp-login.php?redirect_to=https%3A%2F%2Fwww.portall..." 2018/01/08 15:36:42 [error] 1592#1592: *4127 FastCGI sent in stderr: "PHP Warning: Division by zero in /home/portall/public_html/wp-content/plugins/super-socializer/super_socializer.php on line 903" while reading response header from upstream, client: 105.15.24.33, server: portall.co.za, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/php-nginx/151160929049397.sock/socket:", host: "portall.co.za" 2018/01/08 15:38:02 [error] 1592#1592: *4127 FastCGI sent in stderr: "PHP Warning: Division by zero in /home/portall/public_html/wp-content/plugins/super-socializer/super_socializer.php on line 903" while reading response header from upstream, client: 105.15.24.33, server: portall.co.za, request: "GET /wp-login.php?redirect_to=https%3A%2F%2Fwww.portall.co.za%2Fwp-admin%2F&reauth=1 HTTP/1.1", upstream: "fastcgi://unix:/var/php-nginx/151160929049397.sock/socket:", host: "portall.co.za" 2018/01/08 15:38:51 [error] 1592#1592: *4135 FastCGI sent in stderr: "PHP Warning: Division by zero in /home/portall/public_html/wp-content/plugins/super-socializer/super_socializer.php on line 903" while reading response header from upstream, client: 105.15.24.33, server: portall.co.za, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/php-nginx/151160929049397.sock/socket:", host: "portall.co.za" 2018/01/08 15:51:04 [error] 1592#1592: *4161 FastCGI sent in stderr: "PHP Warning: Division by zero in /home/portall/public_html/wp-content/plugins/super-socializer/super_socializer.php on line 903" while reading response header from upstream, client: 105.15.24.33, server: portall.co.za, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/php-nginx/151160929049397.sock/socket:", host: "portall.co.za" 2018/01/08 15:51:11 [error] 1592#1592: *4158 FastCGI sent in stderr: "PHP Warning: Division by zero in /home/portall/public_html/wp-content/plugins/super-socializer/super_socializer.php on line 903" while reading response header from upstream, client: 105.15.24.33, server: portall.co.za, request: "GET /wp-login.php?redirect_to=https%3A%2F%2Fportall.co.za%2Fwp-admin%2F&reauth=1 HTTP/1.1", upstream: "fastcgi://unix:/var/php-nginx/151160929049397.sock/socket:", host: "portall.co.za" 2018/01/08 15:51:23 [error] 1592#1592: *4158 FastCGI sent in stderr: "PHP Warning: Invalid argument supplied for foreach() in /home/portall/public_html/wp-admin/includes/plugin.php on line 1432" while reading response header from upstream, client: 105.15.24.33, server: portall.co.za, request: "GET /wp-admin/admin-ajax.php?postviews_id=174&action=postviews&_=1515419466412 HTTP/1.1", upstream: "fastcgi://unix:/var/php-nginx/151160929049397.sock/socket:", host: "portall.co.za", referrer: "https://portall.co.za/"

Please, please, please help me. I've had this problem since last year. My site is very slow and unstable because of this issue. I really need to launch my site soon or else I'll be bankrupt and forced to close everything.

Regards PresPhuture

Those all look like messages from Wordpress plugins, which we can't do much about.

PresPhuture's picture
Submitted by PresPhuture on Sun, 02/25/2018 - 04:37 Pro Licensee

Status: Active » Closed (fixed)