【发布时间】:2019-06-03 21:13:14
【问题描述】:
我正在尝试访问 localhost / other-40.umwelt-campus.de 上的 index.php 文件 但不是调用页面,而是下载一个空文件.. 即使我下载了 php fpm 并进行了配置。
文件位于:/var/www/html/MyDigitalHome/index.php
部分配置文件如下所示:
root /var/www/html/;
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html index.php;
server_name _;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ /index.php$is_args$args;
# proxy_pass http://localhost:8080;
# proxy_http_version 1.1;
# proxy_set_header Upgrade $http_upgrade;
# proxy_set_header Connection 'upgrade';
# proxy_set_header Host $host;
# proxy_cache_bypass $http_upgrade;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
include snippets/fastcgi-php.conf;
# With php7.3-cgi alone:
#fastcgi_pass 127.0.0.1:9000;
# With php7.3-fpm:
fastcgi_pass unix:/run/php/php7.3-fpm.sock;
}
php 文件看起来像:
<!-- Redirect to MyDigitalHome mainpage-->
<?php
header('Location: /MyDigitalHome/src/services/overview.php');
exit;
【问题讨论】:
-
查看索引和访问日志。也许您的 PHP 脚本正在生成空内容。您可以使用带有单行
<?php phpinfo();的index.php文件来测试您的配置。 -
@RichardSmith index.php 正在显示 php 信息。所以它应该工作......
-
您的 PHP 文件似乎工作正常。
-
@RichardSmith 即使配置了 php.ini,也没有“php_errors.log”。也没有注释掉。那么问题可能是什么?