The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

My Vps Crash During High Traffic

Discussion in 'Workarounds and Optimization' started by dolomats, Jul 31, 2015.

  1. dolomats

    dolomats Active Member

    Joined:
    Dec 14, 2014
    Messages:
    31
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    Website Owner
    Hello,

    I m hosting my website on a VPS and during high traffic my server crashe and goes down until i restart both nginx and apache so i wanna know if it s the vps material or only the configuration

    Code:
    **VPS configuration :**
      64 Bits VMware with Cpanel CentOs 6.6
      6 vCores
      8 Go RAM
    **Web Server configuration :**
    
      Nginx Version: (1.6.2 )
    *Apache 2.4*
    
      Asis (More information)
      Cache (More information)
      Deflate (More information)
      Disk Cache (More information)
      Env (More information)
      Expires (More information)
      File Cache (More information)
      Fileprotect
      Headers (More information)
      MPM Prefork (More information)
      MPM Worker (More information)
      Mod FastCGI v2.3.9 (More information)
      Mod SuPHP 0.7.2 (More information)
      Proxy (More information)
      UniqueId (More information)
      Version (More information)
    
    *PHP 5.5*
    
      Bcmath (More information)
      CGI (More information)
      Calendar (More information)
      CurlSSL (More information)
      Exif (More information)
      FTP (More information)
      GD (More information)
      Iconv (More information)
      Imap (More information)
      MailHeaders (More information)
      Mbregex
      Mbstring (More information)
      Mcrypt (More information)
      MySQL "Improved" extension. (More information)
      Mysql (More information)
      Mysql of the system (More information)
      Openssl (More information)
      PDO (More information)
      PDO MySQL (More information)
      POSIX (More information)
      Pear (More information)
      Sockets (More information)
      TTF (FreeType) (More information)
      Zip (More information)
      Zlib (More information)
    
    Additional OptMods
    
      Mod Security 2.9.0 (More information)
      mod_pagespeed (More information)
    
    Security
    
      ConfigServer Security & Firewall
    
    **Nginx Configuration**
    
      user  nobody;
      # no need for more workers in the proxy mode
      worker_processes  6;
      error_log  /var/log/nginx/error.log warn;
      worker_rlimit_nofile 20480;
      events {
      worker_connections 5120; # increase for busier servers
      use epoll; # you should use epoll here for Linux kernels 2.6.x
      }
      http {
      server_name_in_redirect off;
      server_names_hash_max_size 10240;
      server_names_hash_bucket_size 1024;
      include  mime.types;
      default_type  application/octet-stream;
      server_tokens off;
      # remove/commentout disable_symlinks if_not_owner;if you get Permission denied error
      # disable_symlinks if_not_owner;
      sendfile on;
      tcp_nopush on;
      tcp_nodelay on;
      keepalive_timeout  5;
      gzip on;
      gzip_vary on;
      gzip_disable "MSIE [1-6]\.";
      gzip_proxied any;
      gzip_http_version 1.0;
      gzip_min_length  1000;
      gzip_comp_level  6;
      gzip_buffers  16 8k;
      # You can remove image/png image/x-icon image/gif image/jpeg if you have slow CPU
      gzip_types  text/plain text/xml text/css application/x-javascript application/xml  application/javascript application/xml+rss text/javascript application/atom+xml;
      ignore_invalid_headers on;
      client_header_timeout  3m;
      client_body_timeout 3m;
      send_timeout  3m;
      reset_timedout_connection on;
      connection_pool_size  256;
      client_header_buffer_size 256k;
      large_client_header_buffers 4 256k;
      client_max_body_size 200M;
      client_body_buffer_size 128k;
      request_pool_size  32k;
      output_buffers  4 32k;
      postpone_output  1460;
      proxy_temp_path  /tmp/nginx_proxy/;
      proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=microcache:15m inactive=24h max_size=500m;
      client_body_in_file_only on;
      log_format bytes_log "$msec $bytes_sent .";
      log_format custom_microcache '$remote_addr - $remote_user [$time_local] '
      '"$request" $status $body_bytes_sent '
      '"$http_referer" "$http_user_agent" nocache:$no_cache';
      include "/etc/nginx/vhosts/*";
      }
    
    **Nginx Vhost:**
    
      server {
      error_log /var/log/nginx/vhost-error_log warn;
      listen 33.44.55.66.4:80;
      listen [::]:80;
        server_name website.com www.website.com;
      access_log /usr/local/apache/domlogs/website.com-bytes_log bytes_log;
      access_log /usr/local/apache/domlogs/website.com combined;
      root /home/websiteroot/public_html;
      #location / {
      location ~*.*\.(3gp|gif|jpg|jpeg|png|ico|wmv|avi|asf|asx|mpg|mpeg|mp4|pls|mp3|mid|wav|swf|flv|html|htm|txt|js|css|exe|zip|tar|rar|gz|tgz|bz2|uha|7z|doc|docx|xls|xlsx|pdf|iso)$ {
      expires 1M;
      try_files $uri @backend;
      }
      location / {
        error_page 405 = @backend;
      add_header X-Cache "HIT from Backend";
      proxy_pass http://33.44.55.66.4:8081;
      include proxy.inc;
        include microcache.inc;
      }
      location @backend {
      internal;
      proxy_pass http://33.44.55.66.4:8081;
      include proxy.inc;
        include microcache.inc;
      }
      location ~ .*\.(php|jsp|cgi|pl|py)?$ {
      proxy_pass http://33.44.55.66.4:8081;
      include proxy.inc;
        include microcache.inc;
      }
      location ~ /\.ht {
      deny all;
      }
      }
    
    Mysql Configuration:
    
      [mysqld]
      local-infile=0
      max_connections = 500
      max_user_connections=1000
      key_buffer_size = 384M
      myisam_sort_buffer_size = 64M
      read_buffer_size = 1M
      table_open_cache = 5000
      thread_cache_size = 384
      wait_timeout = 20
      connect_timeout = 10
      tmp_table_size = 192M
      max_heap_table_size = 92M
      max_allowed_packet=268435456
      net_buffer_length = 16384
      max_connect_errors = 10
      concurrent_insert = 2
      read_rnd_buffer_size = 786432
      bulk_insert_buffer_size = 8M
      query_cache_limit = 4M
      query_cache_size = 92M
      query_cache_type = 1
      query_prealloc_size = 262144
      query_alloc_block_size = 65535
      transaction_alloc_block_size = 8192
      transaction_prealloc_size = 4096
      max_write_lock_count = 8
      log-error
      external-locking=FALSE
      open_files_limit=40000
    
      [mysqld_safe]
    
      [mysqldump]
      quick
      max_allowed_packet = 16M
    
      [isamchk]
      key_buffer = 320M
      sort_buffer = 320M
      read_buffer = 192M
      write_buffer = 192M
    
      [myisamchk]
      key_buffer = 320M
      sort_buffer = 320M
      read_buffer = 192M
      write_buffer = 192M
    
      #### Per connection configuration ####
      sort_buffer_size = 1M
      join_buffer_size = 1M
      thread_stack = 192K
    
    
    Apache Logs
    
      [Fri Jul 31 15:04:44.612352 2015] [fcgid:warn] [pid 14846:tid 140380100081408] [client 22.33.44.55:46757] mod_fcgid: can't apply process slot for /usr/local/cpanel/cgi-sys/php5, referer: http://www.sitereferer1.com/une/actualite/poste1
      [Fri Jul 31 15:04:44.613249 2015] [fcgid:warn] [pid 14846:tid 140380133652224] [client 22.33.44.55:46758] mod_fcgid: can't apply process slot for /usr/local/cpanel/cgi-sys/php5, referer: http://sitereferer2.com/poste2
      [Fri Jul 31 15:10:27.882539 2015] [fcgid:warn] [pid 15229:tid 140380210960128] [client 22.33.44.55:55378] mod_fcgid: can't apply process slot for /usr/local/cpanel/cgi-sys/php5, referer: http://sitereferer2.com/info/poste3.html
      [Fri Jul 31 15:04:46.528501 2015] [mpm_worker:error] [pid 3137:tid 140380361947072] AH00288: scoreboard is full, not at MaxRequestWorkers
    
    Nginx Vhost-error
    
      2015/07/31 15:03:38 [error] 3145#0: *2551737 upstream prematurely closed connection while reading response header from upstream, client: 111.333.555.777, server: mysite.com, request: "GET /template/ext/40f0cd2c/includes/styles_thumbnails.css.php?width=235&height=130 HTTP/1.1", upstream: "http://22.33.44.55:8081/template/ext/40f0cd2c/includes/styles_thumbnails.css.php?width=235&height=130", host: "mysite.com", referrer: "http://mysite.com/myposte/"
    
    Last 24h Monitoring

    [​IMG]


    Any help will be welcome thanks
     
    #1 dolomats, Jul 31, 2015
    Last edited: Aug 1, 2015
  2. ModServ

    ModServ Well-Known Member

    Joined:
    Oct 17, 2006
    Messages:
    332
    Likes Received:
    5
    Trophy Points:
    18
    Location:
    Egypt
    cPanel Access Level:
    Root Administrator
    Did you consider optimizing MySQL, Using FastCGI, Optimizing Apache and using PHP-FPM?
     
  3. dolomats

    dolomats Active Member

    Joined:
    Dec 14, 2014
    Messages:
    31
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    Website Owner
    hello,

    i already optimised mysql and using fastcgi, and about php-fpm it is not yet fully supported by cpanel

    i added mysql configuration and monitoring picture.

    Thanks
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,723
    Likes Received:
    660
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
  5. dolomats

    dolomats Active Member

    Joined:
    Dec 14, 2014
    Messages:
    31
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    Website Owner
    So maybe i will downgrade apache version from 2.4.6 to 2.2. !?
     
  6. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,723
    Likes Received:
    660
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
Loading...

Share This Page