【发布时间】:2018-01-19 06:32:17
【问题描述】:
我正在尝试在我的 NGINX 网络服务器上显示 index.php 和 info.php,但由于某种原因我无法让它工作,我的浏览器一直在下载文件而不是显示它们。我尝试了很多教程,但我不知道出了什么问题。
操作系统:Ubuntu 17.10 服务器
PHP 版本:7.1
cgi.fix_pathinfo 设置为 0
www.conf 文件是默认的,除了 de cgi.fix_pathinfo
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
# Add index.php to the list if you are using PHP
index index.php index.html index.htm index.nginx-debian.html;
server_name nginx1.domain.com;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
try_files $uri $uri/ =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
#
# # With php5-cgi alone:
fastcgi_pass 127.0.0.1:9000;
# # With php5-fpm:
fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
#location ~ /\.ht {
# deny all;
#}
}
有人可以帮帮我吗?
【问题讨论】: