Join the community today
Become a Member

Nginx WHMCS 500 errors

Discussion in 'Nginx, PHP-FPM & MariaDB MySQL' started by Robust, Dec 12, 2015.

  1. Robust

    Robust Member

    49
    2
    8
    Jun 14, 2015
    Ratings:
    +4
    Local Time:
    5:59 PM
    1.9.7
    10.1
    Getting WHMCS 500 errors, wonder if you guys can help.

    php config:
    display_errors = On
    error_reporting = E_ALL

    shows no errors, still just a plain blank page on Firefox & Safari, on Chrome it shows its custom 500 error page. Nothing in PHP or nginx error logs. Access logs don't show request. No firewall blocking requests. Other software on same VPS works fine, XenForo, WordPress, custom Laravel install, but WHMCS doesn't. PHP version is 5.6, also supported by WHMCS v6.
     
  2. Matt Williams

    Matt Williams WordPress Fanatic

    468
    90
    28
    Nov 22, 2014
    Virginia, USA
    Ratings:
    +135
    Local Time:
    3:59 AM
    latest
    10
  3. Robust

    Robust Member

    49
    2
    8
    Jun 14, 2015
    Ratings:
    +4
    Local Time:
    5:59 PM
    1.9.7
    10.1
    And I do have the ioncube for PHP 5.6 installed, yeah
     
  4. Matt Williams

    Matt Williams WordPress Fanatic

    468
    90
    28
    Nov 22, 2014
    Virginia, USA
    Ratings:
    +135
    Local Time:
    3:59 AM
    latest
    10
    can you try and do:
     
  5. Robust

    Robust Member

    49
    2
    8
    Jun 14, 2015
    Ratings:
    +4
    Local Time:
    5:59 PM
    1.9.7
    10.1
    Restarting doesn't help, sadly :/
     
  6. Matt Williams

    Matt Williams WordPress Fanatic

    468
    90
    28
    Nov 22, 2014
    Virginia, USA
    Ratings:
    +135
    Local Time:
    3:59 AM
    latest
    10
    you have the lastest WHMCS installed?
     
  7. Robust

    Robust Member

    49
    2
    8
    Jun 14, 2015
    Ratings:
    +4
    Local Time:
    5:59 PM
    1.9.7
    10.1
    (y)
     
  8. Matt Williams

    Matt Williams WordPress Fanatic

    468
    90
    28
    Nov 22, 2014
    Virginia, USA
    Ratings:
    +135
    Local Time:
    3:59 AM
    latest
    10
    did you check all permissions and make sure they were set correctly?
     
  9. Robust

    Robust Member

    49
    2
    8
    Jun 14, 2015
    Ratings:
    +4
    Local Time:
    5:59 PM
    1.9.7
    10.1
    chown'd to web user
     
  10. Matt Williams

    Matt Williams WordPress Fanatic

    468
    90
    28
    Nov 22, 2014
    Virginia, USA
    Ratings:
    +135
    Local Time:
    3:59 AM
    latest
    10
    what do your:
    say?
     
  11. eva2000

    eva2000 Administrator Staff Member

    29,041
    6,589
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,784
    Local Time:
    5:59 PM
    Nginx 1.13.x
    MariaDB 5.5
    Centmin Mod Nginx doesn't enable custom error pages out of the box. What's your full WHMCS vhost conf file look like ?

    if you have alot of disk space and can enable debug nginx, you can enable and compile a nginx debug build of nginx via centmin.sh option NGINX_DEBUG=y centminmod/centmin.sh at 123.08stable · centminmod/centminmod · GitHub You can place the option in persistent config /etc/centminmod/custom_config.inc outlined at centminmod.com/upgrade.html#persistent so place in file /etc/centminmod/custom_config.inc
    Code:
    NGINX_DEBUG=y
    then recompile nginx via centmin.sh menu option 4 and then in your nginx error_log directive add debug option A debugging log and restart nginx and check logs

    They will be very very very verbose and lot alot to disk so ensure you have alot of disk free space.

    You can minimise this by limiting it to specific ip based client connections too
    After debugging is done, reverse the debug now by setting NGINX_DEBUG=n and recompile Nginx again
     
  12. Robust

    Robust Member

    49
    2
    8
    Jun 14, 2015
    Ratings:
    +4
    Local Time:
    5:59 PM
    1.9.7
    10.1
    yeh, it's not like my custom 500 error, it's a:
    [​IMG]

    Code:
    server {
                listen   80;
                server_name domain;
                return 301 https://domain$request_uri;
           }
    
    server {
      listen 443 ssl;
      server_name domain;
    
    # ngx_pagespeed & ngx_pagespeed handler
    #include /usr/local/nginx/conf/pagespeed.conf;
    #include /usr/local/nginx/conf/pagespeedhandler.conf;
    #include /usr/local/nginx/conf/pagespeedstatslog.conf;
    
    ssl on;
    ssl_certificate /usr/local/nginx/conf/ssl/domain.crt;
    ssl_certificate_key /usr/local/nginx/conf/ssl/domain.key;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!3DES:!MD5:!PSK;
    ssl_prefer_server_ciphers on;
    #ssl_session_cache shared:SSL:10m;
    #ssl_session_timeout 10m;
    
      # limit_conn limit_per_ip 16;
      # ssi  on;
    
      access_log /path/to/domain/log/access.log combined buffer=32k;
      error_log /path/to/domain/log/error.log;
    
      root /path/to/domain/public;
      index index.php;
    
      location / {
    try_files $uri $uri/ $uri.php;
    # Announcements
    #rewrite ^/announcements/([0-9]+)/[a-zA-Z0-9-]+\.html$ /./announcements.php?id=$1 last;
    #rewrite ^/announcements$ /./announcements.php last;
    # Downloads
    #rewrite ^/downloads/([0-9]+)/([^/]*)$ /./downloads.php?action=displaycat&catid=$1 last;
    #rewrite ^/downloads$ /./downloads.php last;
    #Knowledgebase
    #rewrite ^/knowledgebase/([0-9]+)/[a-zA-Z0-9-]+\.html$ /./knowledgebase.php?action=displayarticle&id=$1 last;
    #rewrite ^/knowledgebase/([0-9]+)/([^/]*)$ /./knowledgebase.php?action=displaycat&catid=$1 last;
    #rewrite ^/knowledgebase$ /./knowledgebase.php last;
    
    # block common exploits, sql injections etc
    #include /usr/local/nginx/conf/block.conf;
      }
    
      include /usr/local/nginx/conf/php.conf;
    #  include /usr/local/nginx/conf/drop.conf;
    }
    
     
  13. Robust

    Robust Member

    49
    2
    8
    Jun 14, 2015
    Ratings:
    +4
    Local Time:
    5:59 PM
    1.9.7
    10.1
    php logs show nothing
     
  14. eva2000

    eva2000 Administrator Staff Member

    29,041
    6,589
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,784
    Local Time:
    5:59 PM
    Nginx 1.13.x
    MariaDB 5.5
    nothing in that vhost file looks out of place besides missing http2 based ssl directive and ocsp stapling if you have a paid commercial ssl certificate
    Code:
    php --ini
    Configuration File (php.ini) Path: /usr/local/lib
    Loaded Configuration File:         /usr/local/lib/php.ini
    Scan for additional .ini files in: /etc/centminmod/php.d
    Additional .ini files parsed:      /etc/centminmod/php.d/a_customphp.ini,
    /etc/centminmod/php.d/curlcainfo.ini,
    /etc/centminmod/php.d/geoip.ini,
    /etc/centminmod/php.d/imagick.ini,
    /etc/centminmod/php.d/memcached.ini,
    /etc/centminmod/php.d/zendopcache.ini
    Common Troubleshooting Tips - WHMCS Documentation
    for number 5, you could try commenting out with a hash # in front, each php extension added by Centmin Mod source compile as outputted by php --ini command

    Code:
    php --ini
    Configuration File (php.ini) Path: /usr/local/lib
    Loaded Configuration File:         /usr/local/lib/php.ini
    Scan for additional .ini files in: /etc/centminmod/php.d
    Additional .ini files parsed:      /etc/centminmod/php.d/a_customphp.ini,
    /etc/centminmod/php.d/curlcainfo.ini,
    /etc/centminmod/php.d/geoip.ini,
    /etc/centminmod/php.d/imagick.ini,
    /etc/centminmod/php.d/memcached.ini,
    /etc/centminmod/php.d/zendopcache.ini
    so just comment out the zend or extension load *.so line with hash in front and restart nginx and php-fpm via nprestart command and see if you can isolate a problematic php extension

    if it php memory and process limits you can check via
    Code:
    php -i | grep memory_limit
    memory_limit => 160M => 160M
    set from /etc/centminmod/php.d/a_customphp.ini
    Code:
    date.timezone = UTC
    max_execution_time = 60
    short_open_tag = On
    realpath_cache_size = 2048k
    realpath_cache_ttl = 28800
    upload_max_filesize = 160M
    memory_limit = 160M
    post_max_size = 160M
    expose_php = Off
    mail.add_x_header = Off
    max_input_nesting_level = 128
    max_input_vars = 10000
    mysqlnd.net_cmd_buffer_size = 16384
    always_populate_raw_post_data=-1
    raise or change php settings via custom .ini file and not directly in php.ini as per PHP-FPM - CentminMod.com LEMP Nginx web stack for CentOS

    number 2 file user/group ownership and permissions

    and again the above nginx debug mode
     
  15. Matt Williams

    Matt Williams WordPress Fanatic

    468
    90
    28
    Nov 22, 2014
    Virginia, USA
    Ratings:
    +135
    Local Time:
    3:59 AM
    latest
    10
    Sounds like a permissions issue somewhere. I just upgraded ours to the latest but have installed it several times and have come across this before when I didn't set the correct permissions on a folder/file.

    You also might be missing a primary file somewhere. Can you try deleting your current install, download a new zip file from WHMCS and re-upload it and run through the install again?
     
    • Informative Informative x 1
  16. Robust

    Robust Member

    49
    2
    8
    Jun 14, 2015
    Ratings:
    +4
    Local Time:
    5:59 PM
    1.9.7
    10.1
    I disabled it temporarily to see if it was causing WHMCS issues and I'm not sure what the ocsp stapling data is for PositiveSSL COMODO certificate

    Tried, no errors shown or produced. Once enabled, where are errors logged? On the screen or the respective error.log files?

    chown'd properly with correct file perms, just in case I did a chmod to 777 and it didn't fix any of it.

    It is 128MB

    what does nginx debug mode do?

    I did last night. The install went fine, actually. An upgrade to WHMCS v6.2 from v6.0.3. The installer said I pass all requirements and said the upgrade completed successfully. After, it said remove the install directory to begin using WHMCS, as it's a security concern. I did, and then the blank pages and 500 errors started.
     
  17. Matt Williams

    Matt Williams WordPress Fanatic

    468
    90
    28
    Nov 22, 2014
    Virginia, USA
    Ratings:
    +135
    Local Time:
    3:59 AM
    latest
    10
    have you tried commenting out:

    in:
     
  18. eva2000

    eva2000 Administrator Staff Member

    29,041
    6,589
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,784
    Local Time:
    5:59 PM
    Nginx 1.13.x
    MariaDB 5.5
    OCSP improves SSL performance OCSP stapling - Wikipedia, the free encyclopedia
    could be too low, try raising it to 256MB at least

    nginx debug as it stats debugs every connection and process that goes through nginx Debugging | NGINX it's very verbose

    never used WHMCS, so no idea if removing the install directory has a particular right and wrong way of doing it
     
  19. eva2000

    eva2000 Administrator Staff Member

    29,041
    6,589
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,784
    Local Time:
    5:59 PM
    Nginx 1.13.x
    MariaDB 5.5
  20. Robust

    Robust Member

    49
    2
    8
    Jun 14, 2015
    Ratings:
    +4
    Local Time:
    5:59 PM
    1.9.7
    10.1
    I managed to fix it, basically stupid WHMCS software, not much to do with the system itself. WHMCS is just a bunch of obfuscated code that has no application logs, so when 500 errors happen they say it's your system. When you're puzzled why it's not being logged, it's because it's application side (bad WHMCS hooks) which isn't logged anywhere because they handle all logging but don't show the end user any of it!

    I'll look into OCSP stapling. Any info on enabling it with PositiveSSL w/ nginx?