Learn about Centmin Mod LEMP Stack today
Register Now

HTTP 500 Error

Discussion in 'Nginx, PHP-FPM & MariaDB MySQL' started by skringjer, Jan 19, 2020.

Tags:
  1. skringjer

    skringjer NoobMaster69

    208
    26
    28
    Apr 21, 2019
    Ratings:
    +43
    Local Time:
    6:14 PM
    Nginx 1.21.6
    MariaDB 10.3.x
    Please fill in any relevant information that applies to you:
    • CentOS Version: CentOS 7 64 bit
    • Centmin Mod Version Installed: 123.09beta01
    • Nginx Version Installed: 1.17.7
    • PHP Version Installed: 7.3.7
    • MariaDB MySQL Version Installed: 10.3.21
    • When was last time updated Centmin Mod code base ? : Auto-updates
    • Persistent Config:
      Code (Text):
      LETSENCRYPT_DETECT='y'
      VHOSTCTRL_CLOUDFLAREINC='y'
      

    So i have 3 sites running on the same Centmin server, all 3 sites with exact same nginx and php configs.


    2 of the 3 sites are working properly fine except one. So i am running a PHP script on it, everything is fine except on the download pages i get HTTP error 500, all other pages working except for this one. There is a nginx location block for this too, but i dont know why isnt this site working.

    The other 2 sites are exactly the same with same nginx confs but this one isnt working, here is

    Code:
    # Centmin Mod Getting Started Guide
    # must read http://centminmod.com/getstarted.html
    # For HTTP/2 SSL Setup
    # read http://centminmod.com/nginx_configure_https_ssl_spdy.html
    
    # redirect from www to non-www  forced SSL
    # uncomment, save file and restart Nginx to enable
    # if unsure use return 302 before using return 301
     server {
           listen   MY_IP:80;
           server_name mydomain.com www.mydomain.com;
           return 301 https://$server_name$request_uri;
     }
    
    server {
      listen MY_IP:443 ssl http2;
      server_name mydomain.com;
    
      include /usr/local/nginx/conf/ssl/mydomain.com/mydomain.com.crt.key.conf;
      include /usr/local/nginx/conf/ssl_include.conf;
    
      # cloudflare authenticated origin pull cert community.centminmod.com/threads/13847/
      #ssl_client_certificate /usr/local/nginx/conf/ssl/cloudflare/mydomain.com/origin.crt;
      #ssl_verify_client on;
      http2_max_field_size 16k;
      http2_max_header_size 32k;
      http2_max_requests 5000;
      # mozilla recommended
      ssl_ciphers TLS13-AES-128-GCM-SHA256:TLS13-AES-256-GCM-SHA384:TLS13-CHACHA20-POLY1305-SHA256:TLS13-AES-128-CCM-8-SHA256:TLS13-AES-128-CCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS;
      ssl_prefer_server_ciphers   on;
      #add_header Alternate-Protocol  443:npn-spdy/3;
    
      # before enabling HSTS line below read centminmod.com/nginx_domain_dns_setup.html#hsts
      #add_header Strict-Transport-Security "max-age=31536000; includeSubdomains;";
      #add_header X-Frame-Options SAMEORIGIN;
      add_header X-Xss-Protection "1; mode=block" always;
      add_header X-Content-Type-Options "nosniff" always;
      #add_header Referrer-Policy "strict-origin-when-cross-origin";
      #add_header Feature-Policy "accelerometer 'none'; camera 'none'; geolocation 'none'; gyroscope 'none'; magnetometer 'none'; microphone 'none'; payment 'none'; usb 'none'";
      #spdy_headers_comp 5;
      ssl_buffer_size 1369;
      ssl_session_tickets on;
     
      # enable ocsp stapling
      resolver 8.8.8.8 8.8.4.4 1.1.1.1 1.0.0.1 valid=10m;
      resolver_timeout 10s;
      ssl_stapling on;
      ssl_stapling_verify on;
    
    # 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;
    
      # limit_conn limit_per_ip 16;
      # ssi  on;
    
      access_log /home/nginx/domains/mydomain.com/log/access.log combined buffer=256k flush=5m;
      error_log /home/nginx/domains/mydomain.com/log/error.log;
    
      include /usr/local/nginx/conf/autoprotect/mydomain.com/autoprotect-mydomain.com.conf;
      root /home/nginx/domains/mydomain.com/public;
      # uncomment cloudflare.conf include if using cloudflare for
      # server and/or vhost site
      include /usr/local/nginx/conf/cloudflare.conf;
      include /usr/local/nginx/conf/503include-main.conf;
    
      # allow for paths ending with forward slashes
        rewrite ^/app/(.*)/ /plugins/webdav/site/control/$1 last;
        rewrite ^/app/(.*) /plugins/webdav/site/control/$1 last;
    
        # all webdav requests
        location /plugins/webdav/site/control/ {
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            gzip off;
            fastcgi_pass 127.0.0.1:9000;
            fastcgi_index index.php;
            fastcgi_param MOD_X_ACCEL_REDIRECT_ENABLED on;
            include fastcgi_params;
        }
    
    
        location ~ /api/v2/ {
          include /usr/local/nginx/conf/php-api.conf;
          rewrite ^/api/v2/(.*)$ /api/v2/index.php?_page_url=$1 last;
        }
    
        location / {
            if (!-e $request_filename) {
                rewrite ^/(.*) /index.php?_page_url=$1 last;
            }
        }
    
    
        location /files/ {
            internal;
        }
    
        # these locations would be hidden by .htaccess normally
        location /core/logs/ {
            deny all;
        }
    
      #include /usr/local/nginx/conf/pre-staticfiles-local-mydomain.com.conf;
      #include /usr/local/nginx/conf/pre-staticfiles-global.conf;
      include /usr/local/nginx/conf/staticfiles-custom.conf;
      #include /usr/local/nginx/conf/php.conf;
      include /usr/local/nginx/conf/php-custom.conf;
      include /usr/local/nginx/conf/drop.conf;
      #include /usr/local/nginx/conf/errorpage.conf;
      include /usr/local/nginx/conf/vts_server.conf;
    }
    
    Here is /usr/local/nginx/conf/staticfiles-custom.conf;
    Code:
        # prepare for letsencrypt
        # https://community.centminmod.com/posts/17774/
        location ~ /.well-known { location ~ /.well-known/acme-challenge/(.*) { more_set_headers    "Content-Type: text/plain"; } }
    
        location ~* \.(gif|jpg|jpeg|png|ico)$ {
            if (!-e $request_filename) {
                rewrite ^/(.*) /index.php?_page_url=$1 last;
            }
          gzip_static off;
          #add_header Pragma public;
          #add_header X-Frame-Options SAMEORIGIN;
          #add_header X-Xss-Protection "1; mode=block" always;
          #add_header X-Content-Type-Options "nosniff" always;
          add_header Access-Control-Allow-Origin *;
          add_header Cache-Control "public, must-revalidate, proxy-revalidate, immutable, stale-while-revalidate=86400, stale-if-error=604800";
          access_log off;
          expires 30d;
          break;
        }
    
        location ~* \.(3gp|wmv|avi|asf|asx|mpg|mpeg|mp4|pls|mp3|mid|wav|swf|flv|exe|zip|tar|rar|gz|tgz|bz2|uha|7z|doc|docx|xls|xlsx|pdf|iso)$ {
            if (!-e $request_filename) {
                rewrite ^/(.*) /index.php?_page_url=$1 last;
            }
          gzip_static off;
          sendfile off;
          sendfile_max_chunk 1m;
          #add_header Pragma public;
          #add_header X-Frame-Options SAMEORIGIN;
          #add_header X-Xss-Protection "1; mode=block" always;
          #add_header X-Content-Type-Options "nosniff" always;
          add_header Access-Control-Allow-Origin *;
          add_header Cache-Control "public, must-revalidate, proxy-revalidate, immutable, stale-while-revalidate=86400, stale-if-error=604800";
          access_log off;
          expires 30d;
          break;
        }
    
        location ~* \.(js)$ {
      #add_header Pragma public;
      #add_header X-Frame-Options SAMEORIGIN;
      #add_header X-Xss-Protection "1; mode=block" always;
      #add_header X-Content-Type-Options "nosniff" always;
      #add_header Referrer-Policy "strict-origin-when-cross-origin";
      add_header Access-Control-Allow-Origin *;
      add_header Cache-Control "public, must-revalidate, proxy-revalidate, immutable, stale-while-revalidate=86400, stale-if-error=604800";
        access_log off;
        expires 30d;
        break;
            }
    
        location ~* \.(css)$ {
      #add_header Pragma public;
      #add_header X-Frame-Options SAMEORIGIN;
      #add_header X-Xss-Protection "1; mode=block" always;
      #add_header X-Content-Type-Options "nosniff" always;
      #add_header Referrer-Policy "strict-origin-when-cross-origin";
      add_header Access-Control-Allow-Origin *;
      add_header Cache-Control "public, must-revalidate, proxy-revalidate, immutable, stale-while-revalidate=86400, stale-if-error=604800";
        access_log off;
        expires 30d;
        break;
            }
    
      #  location ~* \.(html|htm|txt)$ {
      #add_header Pragma public;
      #add_header X-Frame-Options SAMEORIGIN;
      #add_header X-Xss-Protection "1; mode=block" always;
      #add_header X-Content-Type-Options "nosniff" always;
      #add_header Referrer-Policy "strict-origin-when-cross-origin";
        #add_header Cache-Control "public, must-revalidate, proxy-revalidate";
        #access_log off;
        #expires 1d;
        #break;
      #      }
    
        location ~* \.(eot|svg|ttf|woff|woff2)$ {
      #add_header Pragma public;
      #add_header X-Frame-Options SAMEORIGIN;
      #add_header X-Xss-Protection "1; mode=block" always;
      #add_header X-Content-Type-Options "nosniff" always;
      #add_header Referrer-Policy "strict-origin-when-cross-origin";
      add_header Access-Control-Allow-Origin *;
      add_header Cache-Control "public, must-revalidate, proxy-revalidate";
        access_log off;
        expires 365d;
        break;
            }
    
    And here is include /usr/local/nginx/conf/php-custom.conf;
    Code:
    location ~ [^/]\.php(/|$) {
    #  include /usr/local/nginx/conf/503include-only.conf;
    #    fastcgi_split_path_info ^(.+?\.php)(/.*)$;
        if (!-e $request_filename) {
            rewrite ^/(.*) /index.php?_page_url=$1 last;
        }
        fastcgi_keep_conn on;
        fastcgi_pass dft_php;
        #fastcgi_pass   127.0.0.1:9000;
        #fastcgi_pass   unix:/tmp/php5-fpm.sock;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        fastcgi_param MOD_X_ACCEL_REDIRECT_ENABLED on;
    
    # might shave 200+ ms off PHP requests
    # which don't pass on a content length header
    # slightly faster page response time at the
    # expense of throughput / scalability
    #sendfile on;
    #tcp_nopush off;
    #keepalive_requests 0;
    
    fastcgi_connect_timeout 60s;
    fastcgi_send_timeout 180s;
    fastcgi_read_timeout 300s;
    fastcgi_buffer_size 512k;
    fastcgi_buffers 512 16k;
    fastcgi_busy_buffers_size 1m;
    fastcgi_temp_file_write_size 4m;
    fastcgi_max_temp_file_size 4m;
    fastcgi_intercept_errors off;
    
    # next 3 lines when uncommented / enabled
    # allow Nginx to handle uploads which then
    # passes back the completed upload to PHP
    #fastcgi_pass_request_body off;
    #client_body_in_file_only clean;
    #fastcgi_param  REQUEST_BODY_FILE  $request_body_file;
    
    #new .04+ map method
    fastcgi_param HTTPS $server_https;
    
    # comment out PATH_TRANSLATED line if /usr/local/lib/php.ini sets following:
    # cgi.fix_pathinfo=0
    # as of centminmod v1.2.3-eva2000.01 default is set to cgi.fix_pathinfo=1
    
    fastcgi_param  PATH_INFO          $fastcgi_path_info;
    fastcgi_param  PATH_TRANSLATED    $document_root$fastcgi_path_info;
    
    fastcgi_param  QUERY_STRING       $query_string;
    fastcgi_param  REQUEST_METHOD     $request_method;
    fastcgi_param  CONTENT_TYPE       $content_type;
    fastcgi_param  CONTENT_LENGTH     $content_length;
    
    fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
    fastcgi_param  REQUEST_URI        $request_uri;
    fastcgi_param  DOCUMENT_URI       $document_uri;
    fastcgi_param  DOCUMENT_ROOT      $document_root;
    fastcgi_param  SERVER_PROTOCOL    $server_protocol;
    fastcgi_param  REQUEST_SCHEME     $scheme;
    fastcgi_param  HTTPS              $https if_not_empty;
    fastcgi_param  HTTP_PROXY         "";
    
    fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
    fastcgi_param  SERVER_SOFTWARE    nginx/$nginx_version;
    
    fastcgi_param  REMOTE_ADDR        $remote_addr;
    fastcgi_param  REMOTE_PORT        $remote_port;
    fastcgi_param  SERVER_ADDR        $server_addr;
    fastcgi_param  SERVER_PORT        $server_port;
    fastcgi_param  SERVER_NAME        $server_name;
    
    # Set php-fpm geoip variables
    fastcgi_param GEOIP_COUNTRY_CODE $geoip_country_code;
    fastcgi_param GEOIP_COUNTRY_CODE3 $geoip_country_code3;
    fastcgi_param GEOIP_COUNTRY_NAME $geoip_country_name;
    fastcgi_param GEOIP_CITY_COUNTRY_CODE $geoip_city_country_code;
    fastcgi_param GEOIP_CITY_COUNTRY_CODE3 $geoip_city_country_code3;
    fastcgi_param GEOIP_CITY_COUNTRY_NAME $geoip_city_country_name;
    fastcgi_param GEOIP_REGION $geoip_region;
    fastcgi_param GEOIP_CITY $geoip_city;
    fastcgi_param GEOIP_POSTAL_CODE $geoip_postal_code;
    fastcgi_param GEOIP_CITY_CONTINENT_CODE $geoip_city_continent_code;
    fastcgi_param GEOIP_LATITUDE $geoip_latitude;
    fastcgi_param GEOIP_LONGITUDE $geoip_longitude;
    
    # PHP only, required if PHP was built with --enable-force-cgi-redirect
    fastcgi_param  REDIRECT_STATUS    200;
    
                       }
    
    The problem is i have nothing in my error logs, any help please?
     
  2. eva2000

    eva2000 Administrator Staff Member

    53,178
    12,112
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,647
    Local Time:
    11:14 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    use a file comparison tool and compare your working files to your not working files to see exactly the differences

    beyondcompare is what i use or you can use a online diff tool like https://www.diffchecker.com/
     
  3. skringjer

    skringjer NoobMaster69

    208
    26
    28
    Apr 21, 2019
    Ratings:
    +43
    Local Time:
    6:14 PM
    Nginx 1.21.6
    MariaDB 10.3.x
    I checked them side by side, there is no difference at all, do you see anything in the above conf that could have caused this? been at this from days.
     
  4. eva2000

    eva2000 Administrator Staff Member

    53,178
    12,112
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,647
    Local Time:
    11:14 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    have you checked all nginx and php error logs ?

    official FAQ item 19 lists all log file locations https://centminmod.com/faq.html
     
  5. skringjer

    skringjer NoobMaster69

    208
    26
    28
    Apr 21, 2019
    Ratings:
    +43
    Local Time:
    6:14 PM
    Nginx 1.21.6
    MariaDB 10.3.x
    I checked PHP logs and i find this

    Code (Text):
    [21-Jan-2020 07:54:29 UTC] PHP Fatal error:  Uncaught Error: Call to undefined function eregi() in /home/nginx/domains/mydomain.com/public/core/includes/stats.class.php:193
    Stack trace:
    #0 /home/nginx/domains/mydomain.com/public/core/page/file_download.php(251): Stats::currentDeviceIsIos()
    #1 /home/nginx/domains/mydomain.com/public/index.php(95): require_once('/home/nginx/dom...')
    #2 {main}
      thrown in /home/nginx/domains/mydomain.com/public/core/includes/stats.class.php on line 193
    [21-Jan-2020 07:54:29 UTC] PHP Fatal error:  Uncaught Error: Call to undefined function eregi() in /home/nginx/domains/mydomain.com/public/core/includes/stats.class.php:193
    Stack trace:
    #0 /home/nginx/domains/mydomain.com/public/core/page/file_download.php(251): Stats::currentDeviceIsIos()
    #1 /home/nginx/domains/mydomain.com/public/index.php(95): require_once('/home/nginx/dom...')
    #2 {main}
      thrown in /home/nginx/domains/mydomain.com/public/core/includes/stats.class.php on line 193
    [21-Jan-2020 07:54:30 UTC] PHP Fatal error:  Uncaught Error: Call to undefined function eregi() in /home/nginx/domains/mydomain.com/public/core/includes/stats.class.php:193
    Stack trace:
    #0 /home/nginx/domains/mydomain.com/public/core/page/file_download.php(251): Stats::currentDeviceIsIos()
    #1 /home/nginx/domains/mydomain.com/public/index.php(95): require_once('/home/nginx/dom...')
    #2 {main}
      thrown in /home/nginx/domains/mydomain.com/public/core/includes/stats.class.php on line 193
    [21-Jan-2020 07:54:31 UTC] PHP Fatal error:  Uncaught Error: Call to undefined function eregi() in /home/nginx/domains/mydomain.com/public/core/includes/stats.class.php:193
    Stack trace:
    #0 /home/nginx/domains/mydomain.com/public/core/page/file_download.php(251): Stats::currentDeviceIsIos()
    #1 /home/nginx/domains/mydomain.com/public/index.php(95): require_once('/home/nginx/dom...')
    #2 {main}
      thrown in /home/nginx/domains/mydomain.com/public/core/includes/stats.class.php on line 193
    [21-Jan-2020 07:54:32 UTC] PHP Fatal error:  Uncaught Error: Call to undefined function eregi() in /home/nginx/domains/mydomain.com/public/core/includes/stats.class.php:193
    Stack trace:
    #0 /home/nginx/domains/mydomain.com/public/core/page/file_download.php(251): Stats::currentDeviceIsIos()
    #1 /home/nginx/domains/mydomain.com/public/index.php(95): require_once('/home/nginx/dom...')
    #2 {main}
      thrown in /home/nginx/domains/mydomain.com/public/core/includes/stats.class.php on line 193
    [21-Jan-2020 07:54:33 UTC] PHP Fatal error:  Uncaught Error: Call to undefined function eregi() in /home/nginx/domains/mydomain.com/public/core/includes/stats.class.php:193
    Stack trace:
    #0 /home/nginx/domains/mydomain.com/public/core/page/file_download.php(251): Stats::currentDeviceIsIos()
    #1 /home/nginx/domains/mydomain.com/public/index.php(95): require_once('/home/nginx/dom...')
    #2 {main}
      thrown in /home/nginx/domains/mydomain.com/public/core/includes/stats.class.php on line 193
    
    


    Nothing in the nginx logs
     
  6. eva2000

    eva2000 Administrator Staff Member

    53,178
    12,112
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,647
    Local Time:
    11:14 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Those files seems not compatible with PHP 7.3 ? are they showing up on other 2 working sites with same error messages ?
     
  7. skringjer

    skringjer NoobMaster69

    208
    26
    28
    Apr 21, 2019
    Ratings:
    +43
    Local Time:
    6:14 PM
    Nginx 1.21.6
    MariaDB 10.3.x
    No nothing on the other sites logs, they work fine. all three sites hosted on the same server.

    Tried removing the site completely, re-adding it but still no luck.
     
  8. eva2000

    eva2000 Administrator Staff Member

    53,178
    12,112
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,647
    Local Time:
    11:14 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Try upgrading to PHP 7.3.13 to see if it's a bug or downgrading to PHP 7.2.26 to see if it's compatibility issues.