PHP-FPM error: Primary Script unkown

General Tech Bugs & Fixes 2 years ago

0 1 0 0 0 tuteeHUB earn credit +10 pts

5 Star Rating 1 Rating

Posted on 16 Aug 2022, this text provides information on Bugs & Fixes related to General Tech. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.

Take Quiz To Earn Credits!

Turn Your Knowledge into Earnings.

tuteehub_quiz

Answers (1)

Post Answer
profilepic.png
manpreet Tuteehub forum best answer Best Answer 2 years ago

 

I have a strange bug in my nginx / php-fpm code, I'm trying to set up my development machine to use nginx instead of php's built-in server, but it's not working to good so far:

FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1, server: local.dev, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/run/php-fpm/www.sock:", host: "local.dev"

and my local.conf file for nginx:

server {
  server_name local.dev www.local.dev;
  root /home/richard/Projects/local/web;
  index app_dev.php;

  location / {
      try_files $uri /app_dev.php$is_args$args;
  }

  location ~ \.php {
      fastcgi_pass unix:/run/php-fpm/www.sock;
      fastcgi_split_path_info ^(.+\.php)(/.*)$;
      include fastcgi_params;
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      fastcgi_param DOCUMENT_ROOT $realpath_root;
  }

  error_log /var/log/nginx/local_error.log;
  access_log /var/log/nginx/local_access.log;
  access_log /var/log/nginx/local_scripts.log scripts;

}

local_scripts.log seems correct:

/home/richard/Projects/local/web/app_dev.php > GET / HTTP/1.1

And i have chmod +x all the folders from /home to /web...

Please advice, I think I have looked at all php-fpm / nginx questions here (and there are sooo many)

Also, php-fpm runs as root, the unix socket files is created for user richard with the rights 0777, and the pool is running with my username richard and nginx is running with user richard

No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.