Sponsor:

Server and Web Integrator
Link:
Kloxo-MR logo
6.5.0 or 7.0.0
Click for "How to install"
Donation/Sponsorship:
Kloxo-MR is open-source.
Donate and or Sponsorship always welcome.
Click to:
Click Here
Please login or register. 2024-05-04, 02:29:56

Author Topic: website getting 502 error  (Read 4359 times)

0 Members and 1 Guest are viewing this topic.

Offline cmdman

  • Senior Member
  • *
  • Posts: 298
  • Karma: +1/-0
    • View Profile
website getting 502 error
« on: 2015-02-12, 08:18:50 »
Hi Mr..

my client site getting every 5 mints 502 Error i need to restart services then it will works, iam using 6.5.0 and apache or nginx proxy both get same problem even nginx..

we have traffic of
Online now: 525 (Members: 317, Guests: 208)

Offline MRatWork

  • Administrator
  • The Elite
  • *****
  • Posts: 15,807
  • Karma: +119/-11
  • Gender: Male
    • View Profile
    • MRatWork Forum
Re: website getting 502 error
« Reply #1 on: 2015-02-12, 08:55:15 »
Need increasing php-fpm children/thread (need modified custom.php53-fpm-pool.conf.tpl and or apache thread (use 'apache optimize')
..:: MRatWork (Mustafa Ramadhan Projects) ::..
-- Server/Web-integrator - Web Hosting (Kloxo-MR READY!) --

Offline cmdman

  • Senior Member
  • *
  • Posts: 298
  • Karma: +1/-0
    • View Profile
Re: website getting 502 error
« Reply #2 on: 2015-02-12, 08:59:03 »
yes i done it .. still same problem sites often gets 502 and sql errors when have online users are more

Offline MRatWork

  • Administrator
  • The Elite
  • *****
  • Posts: 15,807
  • Karma: +119/-11
  • Gender: Male
    • View Profile
    • MRatWork Forum
Re: website getting 502 error
« Reply #3 on: 2015-02-12, 09:05:57 »
How much ram, client amount and php-fpm children?. Also optimize mysql?.
..:: MRatWork (Mustafa Ramadhan Projects) ::..
-- Server/Web-integrator - Web Hosting (Kloxo-MR READY!) --

Offline cmdman

  • Senior Member
  • *
  • Posts: 298
  • Karma: +1/-0
    • View Profile
Re: website getting 502 error
« Reply #4 on: 2015-02-12, 09:10:19 »
i have 32 GB ram dedicate server , only single website no other sites, i run mysql tuner and added all fixes..

 >>  MySQLTuner 1.4.0 - Major Hayden <major@mhtx.net>
 >>  Bug reports, feature requests, and downloads at http://mysqltuner.com/
 >>  Run with '--help' for additional options and output filtering
[OK] Currently running supported MySQL version 5.5.41
[OK] Operating on 64-bit architecture

Offline MRatWork

  • Administrator
  • The Elite
  • *****
  • Posts: 15,807
  • Karma: +119/-11
  • Gender: Male
    • View Profile
    • MRatWork Forum
Re: website getting 502 error
« Reply #5 on: 2015-02-12, 09:15:58 »
Inform here your custom.php53-fpm-pool.conf.tpl and content of /etc/httpd/conf.d/~lxcenter.conf
..:: MRatWork (Mustafa Ramadhan Projects) ::..
-- Server/Web-integrator - Web Hosting (Kloxo-MR READY!) --

Offline cmdman

  • Senior Member
  • *
  • Posts: 298
  • Karma: +1/-0
    • View Profile
Re: website getting 502 error
« Reply #6 on: 2015-02-12, 09:35:39 »
/etc/httpd/conf.d/~lxcenter.conf
Quote
Timeout 150
KeepAlive Off
MaxKeepAliveRequests 100
KeepAliveTimeout 15

<IfModule prefork.c>
    StartServers 2
    MinSpareServers 385
    MaxSpareServers 771
    ServerLimit 771
    <IfVersion >= 2.4>
        MaxRequestWorkers 771
        MaxConnectionsPerChild 2000
    </IfVersion>
    <IfVersion < 2.4>
        MaxClients 771
        MaxRequestsPerChild 2000
    </IfVersion>
    MaxMemFree 2
    SendBufferSize 65536
    ReceiveBufferSize 65536
</IfModule>

<IfModule itk.c>
    StartServers 2
    MinSpareServers 385
    MaxSpareServers 771
    ServerLimit 771
    <IfVersion >= 2.4>
        MaxRequestWorkers 771
        MaxConnectionsPerChild 2000
    </IfVersion>
    <IfVersion < 2.4>
        MaxClients 771
        MaxRequestsPerChild 2000
    </IfVersion>
    MaxMemFree 2
    SendBufferSize 65536
    ReceiveBufferSize 65536
</IfModule>

<IfModule worker.c>
    StartServers 2
    MinSpareThreads 330
    MaxSpareThreads 661
    ThreadsPerChild 25
    <IfVersion >= 2.4>
        MaxRequestWorkers 1000
        MaxConnectionsPerChild 0
    </IfVersion>
    <IfVersion < 2.4>
        MaxClients 1000
        MaxRequestsPerChild 0
    </IfVersion>

    ThreadStackSize 8196
    MaxMemFree 2
    SendBufferSize 65536
    ReceiveBufferSize 65536
</IfModule>

<IfModule event.c>
    StartServers 2
    MinSpareThreads 330
    MaxSpareThreads 661
    ThreadsPerChild 25
    MaxRequestsPerChild 0
    ThreadStackSize 8196
    <IfVersion >= 2.4>
        MaxRequestWorkers 1000
        MaxConnectionsPerChild 0
    </IfVersion>
    <IfVersion < 2.4>
        MaxClients 1000
        MaxRequestsPerChild 0
    </IfVersion>

    SendBufferSize 65536
    ReceiveBufferSize 65536
</IfModule>

Include /home/apache/conf/defaults/*.conf
Include /home/apache/conf/domains/*.conf
Include /home/apache/conf/webmails/*.conf


custom.php53-fpm-pool.conf.tpl
Quote
<?php
    $userinfo = posix_getpwnam($user);

    if ($user === 'apache') {
        // MR -- for future purpose, apache user have uid 50000
        $fpmport = 50000;
        $openbasedir = "/home/kloxo/httpd/:/tmp/:/usr/share/pear/:/var/lib/php/session/";
    } else {
        $userinfo = posix_getpwnam($user);
        $fpmport = (50000 + $userinfo['uid']);
        $openbasedir = "/home/$user/:/tmp/:/usr/share/pear/:/var/lib/php/session/:".
      "/home/kloxo/httpd/script/:/home/kloxo/httpd/disable/";
    }

    if ($user == 'apache') {
        $pool = 'default';
    } else {
        $pool = $user;
    }

    $startservers = '4';
    $minspareservers = '2';
    $maxspareservers = '4';
    $maxchildren = '6';
?>
[<?php echo $pool; ?>]
;listen = 127.0.0.1:<?php echo $fpmport; ?>

listen = /home/php-fpm/sock/<?php echo $user; ?>.sock
listen.backlog = 65536
listen.allowed_clients = 127.0.0.1
listen.owner = <?php echo $user; ?>

listen.group = <?php echo $user; ?>

listen.mode = 0666
user = <?php echo $user; ?>

group = <?php echo $user; ?>

pm = dynamic
pm.max_children = <?php echo $maxchildren; ?>

pm.start_servers = <?php echo $startservers; ?>

pm.min_spare_servers = <?php echo $minspareservers; ?>

pm.max_spare_servers = <?php echo $maxspareservers; ?>

pm.max_requests = 1000
;pm.status_path = /status
;ping.path = /ping
;ping.response = pong
request_terminate_timeout = 120s
request_slowlog_timeout = 30s
slowlog = /var/log/php-fpm/slow.log
rlimit_files = 1024
rlimit_core = 0
;chroot =
;chdir = /var/www
catch_workers_output = yes
security.limit_extensions = .php .php3 .php4 .php5

env[HOSTNAME] = $HOSTNAME
env[PATH] = /usr/local/bin:/usr/bin:/bin
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp

;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f webmaster@domain.com
;php_flag[display_errors] = off
php_admin_value[error_log] = /var/log/php-fpm/error.log
php_admin_value[session.save_path] = /var/lib/php/session
php_admin_flag[log_errors] = on
;php_admin_value[memory_limit] = 64M
php_admin_value[open_basedir] = <?php echo $openbasedir; ?>



now i have
Online now: 632 (Members: 399, Guests: 233)
« Last Edit: 2015-02-12, 09:37:14 by cmdman »

Offline MRatWork

  • Administrator
  • The Elite
  • *****
  • Posts: 15,807
  • Karma: +119/-11
  • Gender: Male
    • View Profile
    • MRatWork Forum
Re: website getting 502 error
« Reply #7 on: 2015-02-12, 09:45:14 »
1. Decrease of  ServerLimit, MaxRequestWorkers and MaxClients to half of previous value (example 385 to 192) for ~lxcenter.conf
2. Modified /home/php-fpm/tpl/php53-fpm-pool.conf.tpl

from:
Code: [Select]
    ...
    $startservers = '4';
    $minspareservers = '2';
    $maxspareservers = '4';
    $maxchildren = '6';
    ...
    pm = dynamic
    ...

to:
Code: [Select]
    ...
    $startservers = '4';
    $minspareservers = '2';
    $maxspareservers = '4';
    $maxchildren = '12';
    ...
    pm = ondemand
    ...

and then run 'sh /script/fixweb; sh /script/restart-web'
..:: MRatWork (Mustafa Ramadhan Projects) ::..
-- Server/Web-integrator - Web Hosting (Kloxo-MR READY!) --

Offline cmdman

  • Senior Member
  • *
  • Posts: 298
  • Karma: +1/-0
    • View Profile
Re: website getting 502 error
« Reply #8 on: 2015-02-12, 09:47:55 »
i get error like this.

The connection to 'mydomain.com' failed.
Error: TimedOut (0x274c).
System.Net.Sockets.SocketException A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 123.23.633.132:80
http://gyazo.com/2ab213f0d256d70fe4dc8c88a70334e4

csf email sent

Time:                    Thu Feb 12 10:14:43 2015 -0500
1 Min Load Avg:          8.19
5 Min Load Avg:          6.03
15 Min Load Avg:         3.29
Running/Total Processes: 12/449

Offline cmdman

  • Senior Member
  • *
  • Posts: 298
  • Karma: +1/-0
    • View Profile
Re: website getting 502 error
« Reply #9 on: 2015-02-12, 11:24:54 »
i can blindly can say this problem is started after recent kloxo panel update release

Offline MRatWork

  • Administrator
  • The Elite
  • *****
  • Posts: 15,807
  • Karma: +119/-11
  • Gender: Male
    • View Profile
    • MRatWork Forum
Re: website getting 502 error
« Reply #10 on: 2015-02-12, 11:29:51 »
Is it another issue?.
..:: MRatWork (Mustafa Ramadhan Projects) ::..
-- Server/Web-integrator - Web Hosting (Kloxo-MR READY!) --

Offline cmdman

  • Senior Member
  • *
  • Posts: 298
  • Karma: +1/-0
    • View Profile
Re: website getting 502 error
« Reply #11 on: 2015-02-12, 11:36:08 »
no still i didnt updated yet   as site have fullusers , i mean to say this problem started recent updated of kloxomr panel   patch release

and backups are not working also

Offline MRatWork

  • Administrator
  • The Elite
  • *****
  • Posts: 15,807
  • Karma: +119/-11
  • Gender: Male
    • View Profile
    • MRatWork Forum
Re: website getting 502 error
« Reply #12 on: 2015-02-12, 11:44:24 »
Did you run 'sh /script/cleanup' after update?
..:: MRatWork (Mustafa Ramadhan Projects) ::..
-- Server/Web-integrator - Web Hosting (Kloxo-MR READY!) --

Offline cmdman

  • Senior Member
  • *
  • Posts: 298
  • Karma: +1/-0
    • View Profile
Re: website getting 502 error
« Reply #13 on: 2015-02-12, 11:46:34 »
yes and even rebooted server tooo

Offline MRatWork

  • Administrator
  • The Elite
  • *****
  • Posts: 15,807
  • Karma: +119/-11
  • Gender: Male
    • View Profile
    • MRatWork Forum
Re: website getting 502 error
« Reply #14 on: 2015-02-12, 11:57:03 »
So, create new thread for different issue.
..:: MRatWork (Mustafa Ramadhan Projects) ::..
-- Server/Web-integrator - Web Hosting (Kloxo-MR READY!) --

 


Top 4 Global Search Engines:    Google    Bing    Baidu    Yahoo

Page created in 0.047 seconds with 21 queries.

web stats analysis