Linux environment uses docker to deploy php environment error File not found.

on Ali CVM, deploy the php development environment using the docker-ce version. After deploying nginx and php-fpm, the end file of the test. Html can be accessed, but the test .php file will report an error as follows:

File not found.

check the nginx error log of docker, and the error is as follows:

FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream

check the php-fpm log under docker. The error is as follows:

[27-Apr-2018 02:58:49] NOTICE: fpm is running, pid 1

[27-Apr-2018 02:58:49] NOTICE: ready to handle connections

172.17.0.3-27/Apr/2018:02:59:26 + 0000 "GET / index.php" 404

execute the following installation nginx and PHP commands:

nginx:docker run-p 808080 docker/nginx/conf/nginx.conf:/etc/nginx/nginx.conf:ro 80-- name my_nginx-v / docker/nginx/conf/nginx.conf:/etc/nginx/nginx.conf:ro-v / docker/nginx/conf/conf.d/:/etc/nginx/conf.d/-v / docker/nginx/logs/:/var/log/nginx/-v / docker/www/myBlog/:/var/html/-- link my_php-fpm-d nginx:1.13
php:docker run-p 9072 docker/www/myBlog:/www 9000-- name my_php-fpm-v / docker/php/conf/php.ini:/etc/php.ini:ro-v / docker/www/myBlog:/www-d php:7.1-fpm
The configuration file for

nginx is as follows:

clipboard.png

online solutions have been read a lot, there is no solution, hope to help, thank you.

Mar.06,2021

A solution has been found:
modify the nginx configuration
fastcgi_param SCRIPT_FILENAME / www$fastcgi_script_name;


< H1 > error consistent: < / H1 >
FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream
< H1 > docker starts phpfpm < / H1 >
sudo docker run \
--name php72 \
--link=mysql:mysql \

**-v /data/html:/var/www/html:ro \** //

-d --privileged=true php:7.2-fpm
< H1 > docker starts nginx < / H1 >
sudo docker run \
--name nginx \
--link=php72:phpfpm \
-d -p 8080:80 \
-v /data/html:/usr/share/nginx/html:rw \
 nginx
< H1 > nginx.conf < / H1 >
   location ~ \.php$ {
       root           /usr/share/nginx/html;
       //
       fastcgi_pass   phpfpm:9000; 
       fastcgi_index  index.php;
       -sharpfastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
       //phpfpm
       fastcgi_param  SCRIPT_FILENAME  /var/www/html/$fastcgi_script_name;
       include        fastcgi_params;
   }
< H1 > the main problem is the mount problem of phpfpm, or the nginx configuration file. The fastcgi_param parameter is incorrect. Don't pull Baidu. What is Baidu searching for? < / H1 >

have you mapped the website directory to docker, brother


brother, have you solved it or not? we have encountered the same problem these two days. It hasn't been solved for a day!

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b32d46-4eaac.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b32d46-4eaac.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?