Welcome to Centmin Mod Community
Register Now

PHP-FPM Issue with Php-FPM

Discussion in 'Nginx, PHP-FPM & MariaDB MySQL' started by Jake, Aug 23, 2016.

  1. Jake

    Jake Member

    76
    10
    8
    Feb 3, 2015
    Ratings:
    +11
    Local Time:
    10:36 PM
    NA
    Maria DB 5.5
    Hi All,
    I need some help cant figure out what this error is.....


    [error] 10796#0: *31 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 209.40.151.194, server: hastehosting.com, request: "GET /test/ HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "HasteHosting- Affordable WebHosting | Hastehosting"
    2016/08/22 20:24:08 [error] 10796#0: *31 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 209.40.151.194, server: hastehosting.com, request: "GET /test/ HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "HasteHosting- Affordable WebHosting | Hastehosting"
    2016/08/22 20:24:09 [error] 10796#0: *31 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 209.40.151.194, server: hastehosting.com, request: "GET /test/ HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "HasteHosting- Affordable WebHosting | Hastehosting"

    Any ideas?
     
  2. Jake

    Jake Member

    76
    10
    8
    Feb 3, 2015
    Ratings:
    +11
    Local Time:
    10:36 PM
    NA
    Maria DB 5.5
    Btw, this is a fresh install.
     
  3. pamamolf

    pamamolf Well-Known Member

    4,101
    428
    83
    May 31, 2014
    Ratings:
    +838
    Local Time:
    3:36 PM
    Nginx-1.26.x
    MariaDB 10.6.x
    Looks like an issue with your fast cgi parameters ....

    This is what i have:

     
  4. eva2000

    eva2000 Administrator Staff Member

    55,801
    12,271
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,857
    Local Time:
    10:36 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    When you create a new nginx vhost domain via centmin.sh menu option 2 or menu option 22 or via /usr/bin/nv cli command line, you will create the Nginx vhost files and directories. You will get an outputted the path location where it will create the domain name's vhost conf file named newdomain.com.conf (and newdomain.com.ssl.conf if you selected yes to self signed SSL)
    • Nginx vhost conf path will be at /usr/local/nginx/conf/conf.d/newdomain.com.conf
    • Nginx HTTP/2 SSL vhost conf path will be at /usr/local/nginx/conf/conf.d/newdomain.com.ssl.conf
    • Nginx Self-Signed SSL Certificate Directory at /usr/local/nginx/conf/ssl/newdomain.com
    • Vhost public web root will be at /home/nginx/domains/newdomain.com/public
    • Vhost log directory will be at /home/nginx/domains/newdomain.com/log
    Please post the contents of /usr/local/nginx/conf/conf.d/newdomain.com.conf and if applicable /usr/local/nginx/conf/conf.d/newdomain.com.ssl.conf wrapped in CODE tags (outlined at How to use forum BBCODE code tags)
     
  5. Jake

    Jake Member

    76
    10
    8
    Feb 3, 2015
    Ratings:
    +11
    Local Time:
    10:36 PM
    NA
    Maria DB 5.5
    Code:
    # Centmin Mod Getting Started Guide
    # must read http://centminmod.com/getstarted.html
    
    # redirect from non-www to www
    # uncomment, save file and restart Nginx to enable
    # if unsure use return 302 before using return 301
    #server {
    #            listen   80;
    #            server_name hastehosting.com;
    #            return 301 $scheme://www.hastehosting.com$request_uri;
    #       }
    
    server {
      server_name hastehosting.com www.hastehosting.com;
    
    # 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;
    


    Code:
    # Centmin Mod Getting Started Guide
    # must read http://centminmod.com/getstarted.html
    # For SPDY 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 {
    #   server_name hastehosting.com www.hastehosting.com;
    #    return 302 https://$server_name$request_uri;
    # }
    
    server {
      listen 443 ssl http2;
      server_name hastehosting.com www.hastehosting.com;
    
      ssl_dhparam /usr/local/nginx/conf/ssl/hastehosting.com/dhparam.pem;
      ssl_certificate      /usr/local/nginx/conf/ssl/hastehosting.com/hastehosting.$
    
    I havent even touched anything in these files. Thanks for the help!
     
  6. eva2000

    eva2000 Administrator Staff Member

    55,801
    12,271
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,857
    Local Time:
    10:36 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    use
    Code (Text):
    cat filename
    

    where filename is vhost file so you can whole contents of file and not just what the linux editor's ssh window shows
     
  7. Jake

    Jake Member

    76
    10
    8
    Feb 3, 2015
    Ratings:
    +11
    Local Time:
    10:36 PM
    NA
    Maria DB 5.5
    Ooops sorry about that lol


    Code:
    [root@server04 ~]# cat /usr/local/nginx/conf/conf.d/hastehosting.com.conf
    # Centmin Mod Getting Started Guide
    # must read http://centminmod.com/getstarted.html
    
    # redirect from non-www to www
    # uncomment, save file and restart Nginx to enable
    # if unsure use return 302 before using return 301
    #server {
    #            listen   80;
    #            server_name hastehosting.com;
    #            return 301 $scheme://www.hastehosting.com$request_uri;
    #       }
    
    server {
      server_name hastehosting.com www.hastehosting.com;
    
    # 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/hastehosting.com/log/access.log combined buffer                                                                                                                                                             =256k flush=60m;
      error_log /home/nginx/domains/hastehosting.com/log/error.log;
    
      root /home/nginx/domains/hastehosting.com/public;
    
      # prevent access to ./directories and files
      location ~ (?:^|/)\. {
       deny all;
      }
    
      location / {
    
    # block common exploits, sql injections etc
    #include /usr/local/nginx/conf/block.conf;
    
      # Enables directory listings when index file not found
      #autoindex  on;
    
      # Shows file listing times as local time
      #autoindex_localtime on;
    
      # Enable for vBulletin usage WITHOUT vbSEO installed
      # More example Nginx vhost configurations at
      # http://centminmod.com/nginx_configure.html
      #try_files    $uri $uri/ /index.php;
    
      }
    
      include /usr/local/nginx/conf/staticfiles.conf;
      include /usr/local/nginx/conf/php.conf;
      include /usr/local/nginx/conf/drop.conf;
      #include /usr/local/nginx/conf/errorpage.conf;
      include /usr/local/nginx/conf/vts_server.conf;
    }
    
    

    Code:
    [root@server04 ~]# cat /usr/local/nginx/conf/conf.d/hastehosting.com.ssl.conf
    # Centmin Mod Getting Started Guide
    # must read http://centminmod.com/getstarted.html
    # For SPDY 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 {
    #   server_name hastehosting.com www.hastehosting.com;
    #    return 302 https://$server_name$request_uri;
    # }
    
    server {
      listen 443 ssl http2;
      server_name hastehosting.com www.hastehosting.com;
    
      ssl_dhparam /usr/local/nginx/conf/ssl/hastehosting.com/dhparam.pem;
      ssl_certificate      /usr/local/nginx/conf/ssl/hastehosting.com/hastehosting.com.crt;
      ssl_certificate_key  /usr/local/nginx/conf/ssl/hastehosting.com/hastehosting.com.key;
      include /usr/local/nginx/conf/ssl_include.conf;
    
      # mozilla recommended
      ssl_ciphers ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305: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:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA:!CAMELLIA:!DES-CBC3-SHA;
      ssl_prefer_server_ciphers   on;
      #add_header Alternate-Protocol  443:npn-spdy/3;
      #add_header Strict-Transport-Security "max-age=31536000; includeSubdomains;";
      #add_header  X-Content-Type-Options "nosniff";
      #add_header X-Frame-Options DENY;
      #spdy_headers_comp 5;
      ssl_buffer_size 1400;
      ssl_session_tickets on;
    
      # enable ocsp stapling
      #resolver 8.8.8.8 8.8.4.4 valid=10m;
      #resolver_timeout 10s;
      #ssl_stapling on;
      #ssl_stapling_verify on;
      #ssl_trusted_certificate /usr/local/nginx/conf/ssl/hastehosting.com/hastehosting.com-trusted.crt;
    
    # 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/hastehosting.com/log/access.log combined buffer=256k flush=60m;
      error_log /home/nginx/domains/hastehosting.com/log/error.log;
    
      root /home/nginx/domains/hastehosting.com/public;
    
      # prevent access to ./directories and files
      location ~ (?:^|/)\. {
       deny all;
      }
    
      location / {
    
    # block common exploits, sql injections etc
    #include /usr/local/nginx/conf/block.conf;
    
      # Enables directory listings when index file not found
      #autoindex  on;
    
      # Shows file listing times as local time
      #autoindex_localtime on;
    
      # Enable for vBulletin usage WITHOUT vbSEO installed
      # More example Nginx vhost configurations at
      # http://centminmod.com/nginx_configure.html
      #try_files    $uri $uri/ /index.php;
    
      }
    
      include /usr/local/nginx/conf/staticfiles.conf;
      include /usr/local/nginx/conf/php.conf;
      include /usr/local/nginx/conf/drop.conf;
      #include /usr/local/nginx/conf/errorpage.conf;
      include /usr/local/nginx/conf/vts_server.conf;
    }
    
     
  8. eva2000

    eva2000 Administrator Staff Member

    55,801
    12,271
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,857
    Local Time:
    10:36 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    you can remove these lines
    Code (Text):
      # prevent access to ./directories and files
      location ~ (?:^|/)\. {
       deny all;
      }
    

    latest 123.09beta01 has them commented out or removed now
    as to rest you now need to configure your web app script with relevant nginx rewrite rules for it to work properly. Just like other web apps have their own specific web app nginx rules from examples at Nginx Configuration Examples - CentminMod.com LEMP Nginx web stack for CentOS