首页 / PHP / 找不到文件nginx php-fpm
找不到文件nginx php-fpm
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了找不到文件nginx php-fpm,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2003字,纯文字阅读大概需要3分钟。
内容图文
![找不到文件nginx php-fpm](/upload/InfoBanner/zyjiaocheng/963/1e7a5cd9b1674ebbbd05ff3daafb7d8b.jpg)
我在这里查看了这样的每个问题并试图应用所述的修复但没有成功.
我正在使用wordpress:4.7.3-php7.0-fpm-alpine docker图像,前面有一个单独的nginx容器.
当我卷曲wordpress时,我得到:
File not found.
当我检查wordpress容器日志时,我得到:
127.0.0.1 - 16/Mar/2017:06:26:24 +0000 "GET /index.php" 404
127.0.0.1 - 16/Mar/2017:06:31:27 +0000 "GET /index.php" 404
127.0.0.1 - 16/Mar/2017:06:32:16 +0000 "GET /index.php" 404
127.0.0.1 - 16/Mar/2017:06:37:17 +0000 "GET /index.php" 404
127.0.0.1 - 16/Mar/2017:06:39:09 +0000 "GET /index.php" 404
实际的nginx错误是:
2017/03/16 06:26:24 [error] 17#17: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 10.128.0.7, server: k8wp, request
: "GET / HTTP/1.0", upstream: "fastcgi://127.0.0.1:9000"
我正在使用php 7
/var/www/html # php-fpm -v
PHP 7.0.16 (fpm-fcgi) (built: Mar 3 2017 23:07:56)
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.0.16, Copyright (c) 1999-2017, by Zend Technologies
我的nginx配置是
server {
root /app;
# Add index.php to the list if you are using PHP
index index.php index.html index.htm index.nginx-debian.html;
server_name _localhost;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php${
try_files $uri =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
我正在运行nginx作为用户www-data:
user www-data;
根据/usr/local/etc/php-fpm.d/www.conf,用户和组被取消注释并设置为www-data
解决方法:
该错误表示您的SCRIPT_FILENAME不正确.你的评论:
in the wordpress container it’s at /var/www/html/index.php in the
nginx container it’s at /app
建议nginx和php-fpm看到不同的文档根目录.
在这种情况下,使用:
fastcgi_param SCRIPT_FILENAME /var/www/html$fastcgi_script_name;
内容总结
以上是互联网集市为您收集整理的找不到文件nginx php-fpm全部内容,希望文章能够帮你解决找不到文件nginx php-fpm所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。