这几天在搞docker-compose中nginx+php环境,搭建好之后出现可以访问.html文件,但是访问不了.php文件

docker-compose中nginx可以访问html无法访问php 提示File not found. ?

 

 

第一种:没有解析php文件

1:更改配置文件nginx.conf 
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; 
替换成下面(就是把你root文件夹设为其他用户允许)

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

2:注意fastcgi_pass

docker-compose中nginx可以访问html无法访问php 提示File not found. ?

 

 因为docker-compose.yml中的php的services叫php-fpm,所以这里就是php-fpm:9000

第一种:数据卷挂载问题

记得把php和nginx挂载在同一个数据卷下面

 docker-compose中nginx可以访问html无法访问php 提示File not found. ?

相关文章:

  • 2021-12-04
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-12
  • 2022-01-29
  • 2021-12-19
猜你喜欢
  • 2021-07-13
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-16
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案