> 信息中心 >

centos7 配置 nginx1.14+php7 返回空白页求教

来源:互联网 编辑:张晓华

有网友碰到过这样的问题:centos7 配置 nginx1.14+php7 返回空白页求教,问题详细内容为:


如图所示,配置后PHP文件没解析出来
PHP版本7.1 Nginx 版本1.14 centos版本7.3
所有服务已启动
配置文件如下

server {
listen 80;
server_name localhost;

#charset koi8-r; #access_log/var/log/nginx/host.access.logmain; location / { root /usr/share/nginx/html; indexindex.php index.html index.htm; } #error_page404/404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504/50x.html; location = /50x.html { root /usr/share/nginx/html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ { #proxy_pass http://127.0.0.1; #} # location ~ .php$ { root /usr/share/nginx/html; fastcgi_split_path_info ^(.+\.php)(.*)$; fastcgi_pass 127.0.0.1:9000; fastcgi_indexindex.php; #fastcgi_param SCRIPT_FILENAME $ document_root $ fastcgi_script_name; include fastcgi_params; } # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /\.ht { #denyall; #}

}
fastcgi_params 文件如下

fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;

fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param REQUEST_SCHEME $scheme;
fastcgi_param HTTPS $https if_not_empty;

fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;

fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;

PHP only, required if PHP was built with --enable-force-cgi-redirect fastcgi_param REDIRECT_STATUS 200;

fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name;

php nginx ,我搜你通过互联网收集了相关的一些解决方案,希望对有过相同或者相似问题的网友提供帮助,具体如下:

解决方案1:
其实很简单 到这里已经配置成功了  <? ?> fastcgi不能识别这样的短标记 改为<?php ?>
解决方案2:
location ~ .php$ {
root /usr/share/nginx/html/;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+.php)(.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME \(document_root\)fastcgi_script_name;
include fastcgi_params;
}
试试这样,加一行 fastcgi_param PATH_INFO $fastcgi_path_info;

centos 配置nginx php 开机重启吗

不需要重启。 只需要重启nginx服务就行了

怎么打开centos 下的nginx配置文件

如果是使用yum安装的话,使用命令,cd /etc/nginx/nginx.conf vi打开即可。

CentOs5.4下配置nginx+php环境

我昨天从网上看到,nginx 0day漏洞 上传图片可入侵百万台服务器,我想如果是自己用VM虚拟机练练手还好,要是做服务器,可得小心了.

centos7 nginx1.10 配置文件在哪

默认安装的话在 /etc/nginx/nginx.conf 还有可能在:/usr/local/nginx/conf/nginx.conf 或者通过 find / -name nginx.conf 查找配置文件在哪儿

centos下nginx+postgresql+php+memcached+apc安装与配置

centos下nginx+postgresql+php+memcached+apc安装与配置具体安装步骤如下:具体安... –zxvf nginx-1.0.13.tar.gz23cd nginx-1.0.1345./configure --prefix=/usr/local/nginx --...

linux服务器centos怎么配置nginx+php+mysql

-j REJECT –reject-with icmp-host-prohibited -A FORWARD -j REJECT –reject-with icmp-host-prohibited COMMIT ~ ~ /etc/init.d/iptables restart #最后重启防火墙使配置生效 2....

centos6.5下配置nginx,nginx页面能出现,php测试页面显示空白!...

1、php5.3以后版本可以配置php-fpm.conf listen = 127.0.0.1:9002 2、启动php-fpm服务器 /etc/init.d/php-fpm start 3、netstat -ntlp检查9001端口是否启动 4、配置nginx server { l...

centos下nginx+php php配置问题(高分悬赏)

重启一下你所用的软件试试

centos5.5 下配置nginx-1.0.5,php-5.3.6,mysql-5.1.48,配好后加入...

php.ini里面有启用这个模块么 memcache的服务启动了么 /etc/init.d/memcached restart

centOs Nginx php oracle 打开页面超级慢,是什么原因?

memcache的服务启动了么 /etc/init.d/memcached restart 页面空白 没有报错么 你可以试下先把php报错打开 看下什么情况啰嗦一句 ... 2011-8-11 centos配置 nginx +mysq...


请注意,本站信息均收集自互联网,相关信息仅供参考,医疗等重要信息请以正规途径为最终意见,本站不承担任何责任!

www.wosoni.com false 互联网 http://www.wosoni.com/blogcnk/mm/ccdkic.html report 2974 解决方案1:其实很简单 到这里已经配置成功了 <? ?>fastcgi不能识别这样的短标记改为<?php ?>解决方案2:location ~ .php$ {root /usr/share/nginx/html/;fastcgi_pass 127.0.0.1:9000;fastcgi_index index.php;fastcgi_split_path_info ^(.+.php)(.*)$;fastcgi_param PATH_INFO

热门图片