Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Shells Virtual Desktop
BMail.ag - Secure Email Service
Server.net
CPLicense.net
VPS Server
Buy VPN
Vultr
VMs for AI
HostDare
HostDare
ReliableSite White-Label Dedicated Hosting for Resellers
InterServer VPS
BMail.ag - Secure Email Service
Best VPN
High-Performance Bare Metal Server Solutions
Karvl.com
Server Mania Cloud Hosting
DataWagon Hosting
AlphaVPS Hosting
Evoxt.com
Clouvider
VPS Hosting with NVMe
Residential IPs in the US & 4G Mobile Proxies in EU & US with Unlimited Bandwidth
ReliableSite White-Label Dedicated Hosting for Resellers
Rabisu - Hosting Solutions
Shells Virtual Desktop
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

plesk 502 bad gateway

ValdVald Member

Hi everyone
I have plesk installed (nginx+php-fpm) on my cloud vps and I am running into a problem while testing the site load with blitz.io. After 80 hits the site returns 502 bad gateway, so I guess somewhere is set up to serve up this number but i can't find where to increase it.

I tried few options including adding this in the nginx config

proxy_buffer_size 128k;

proxy_buffers 4 256k;

proxy_busy_buffers_size 256k;

nothing works so far, maybe its the apache side but I don't know if this can happen from serving request to nginx.

Does anybody have a suggestion?

Comments

  • BayuBayu Member

    Seems not nginx, but you can try to increase php-fpm pool setting

  • ValdVald Member
    edited June 2014

    ok so for every site there is a config which says do not edit here, where would be the place to change these settings and which options should I increase?

    ; ATTENTION!

    ;

    ; DO NOT MODIFY THIS FILE BECAUSE IT WAS GENERATED AUTOMATICALLY,

    ; SO ALL YOUR CHANGES WILL BE LOST THE NEXT TIME THE FILE IS GENERATED.



    ; If you need to customize this file, use either custom PHP settings tab in
    ; Panel or override settings in /var/www/vhosts/system/mysite.com/conf/php.ini.

    ; To override pool configuration options, specify them in [php-fpm-pool-settings]

    ; section of /var/www/vhosts/system/mysite.com/conf/php.ini file.

    [mysite.com]

    ; Don't override following options, they are relied upon by Plesk internally

    prefix = /var/www/vhosts/system/$pool

    user = mysite

    group = mysite

    listen = php-fpm.sock

    listen.owner = myroot

    listen.group = mygroup

    listen.mode = 0660

    ; Following options can be overridden

    chdir = /

    ; By default use ondemand spawning (this requires php-fpm >= 5.3.9)

    pm = ondemand

    pm.max_children = 5

    pm.process_idle_timeout = 10s

    ; Following pm.* options are used only when 'pm = dynamic'

    pm.start_servers = 1

    pm.min_spare_servers = 1

    pm.max_spare_servers = 1

    ; php.ini custom configuration directives

    php_value[open_basedir] = "/var/www/vhosts/mysite.com/:/tmp/"

  • xDutchyxDutchy Member
    edited June 2014

    This would probably be a good place..

    ; If you need to customize this file, use either custom PHP settings tab in
    ; Panel or override settings in /var/www/vhosts/system/mysite.com/conf/php.ini.
    ; To override pool configuration options, specify them in [php-fpm-pool-settings]
    ; section of /var/www/vhosts/system/mysite.com/conf/php.ini file.

    Also; you might not want to run php-fpm as root

  • ValdVald Member

    @xDutchy silly me for not reading the rest of it.

    @xDutchy said:

    >

    Also; you might not want to run php-fpm as root

    this was set by plesk not by me

  • vladimir said: this was set by plesk not by me

    That's quite... curious?

    I'd love to find a vurnerable WordPress install on such a Plesk server, having fun all day by uploading php scripts and running shell executes

  • ValdVald Member

    whats more funny

    specify them in [php-fpm-pool-settings] ; section of /var/www/vhosts/system/mysite.com/conf/php.ini file.

    this file does not exist in the directory :/

  • ValdVald Member
    edited June 2014

    this does not make me happy at all, going downhill after 82 concurrent users


  • @vladimir Did you check top and free -m when you were performing the test?

  • ValdVald Member

    @forthcloud yes and there is only 3mb increase of memory, usually idles at 160mb of 1GB, i have 3 websites and only the one under load returns 502, the other 2 work fine.

  • @vladimir said:

    Can you please check your Apache Logs and PHP-FPM logs?

    The following commands should also help:

    echo 'NGINX_ULIMIT="-n 4096" >> /etc/sysconfig/nginx
    grep 16384 /etc/nginx/nginx.conf worker_rlimit_nofile 16384;
    /etc/init.d/nginx restart
    /usr/local/psa/admin/sbin/httpdmng --reconfigure-all
    
  • jarjar Patron Provider, Top Host, Veteran

    plesk

    Found the problem

  • @vladimir said:
    this file does not exist in the directory :/

    Replace the "mysite.com" with your own domain.

    /var/www/vhosts/system/mysite.com/conf/php.ini

  • ValdVald Member
    edited June 2014

    @forthcloud That was fine, i just replaced in the post so my domain stays private

    however my nginx config file was lacking worker_rlimit_nofile option

    I added it now and Im going to test again.

    thanks

  • ValdVald Member
    edited June 2014

    still same

    nginx 502 Bad Gateway

    and same message
    The first timeout happened at 5 seconds into the test when the number of concurrent users was at 82.

    I feel I am hitting in the wrong place all the time

  • @vladimir said:

    What type of content are you hosting?

  • ValdVald Member

    @forthcloud php sites

    I know this is comming from plesk since I have worked on many enterprise solutions and I know what I am doing, the problems lies somewhere in plesk but where exactly... the configs are mixed up and scattered all over so Im having a hard time finding the right place.

    one thing I know for sure now is that plesk isolates configs and processes for each site since only one site goes down and the others work fine.

  • @vladimir said:

    Have you checked /var/log/sw-cp-server/error_log? If you can submit a ticket, we will log in to your server and fix it for you.

  • ValdVald Member
    edited June 2014

    @forthcloud that log is empty, and although I am very grateful to you i ordered unmanaged service, i don't expect you to fix these issues for me, on the other hand I also want to learn how to fix problems my self :P

    btw the nginx error log is pretty heavy - 30mb

    2014/06/08 18:38:37 [error] 30933#0: *55067 connect() to unix:/var/www/vhosts/system/mysite.com/php-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 54.***.**.9, server: mysite.com, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/www/vhosts/system/mysite.com/php-fpm.sock:", host: "mysite.com"

    the problem lays somewhere here

  • forthcloudforthcloud Member
    edited June 2014

    @vladimir Try to edit /etc/nginx/nginx.conf file and add following value, then restart.

    send_timeout 120;
    proxy_read_timeout 120;
    proxy_connect_timeout 120;
    
  • ValdVald Member
    edited June 2014

    @forthcloud still same result

    I also turned off nginx to serve php scripts by apache and the result is 82 users = 500 HTTP Internal Server Error, Instead of Bad Gateway

    memory used 360mb

    UPDATE: this guy has same problem http://forum.parallels.com/pda/index.php/t-289980.html

  • ValdVald Member
    edited July 2014

    --UPDATE--

    problem solved a while ago, just increase php-fpm max child processes.

Sign In or Register to comment.