使用PHP5-FPM的Nginx-提供空白屏幕的.php文件
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了使用PHP5-FPM的Nginx-提供空白屏幕的.php文件,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1842字,纯文字阅读大概需要3分钟。
内容图文
![使用PHP5-FPM的Nginx-提供空白屏幕的.php文件](/upload/InfoBanner/zyjiaocheng/948/f624c25b38104472b4018cdfe3e741c3.jpg)
我把头撞在墙上,试图启动nginx并使用php5-fpm运行.我觉得这只是我忽略的一个小细节,所以我休息了一会儿,几天后又回到了上面.今晚又弄乱了几个小时,无济于事.
无论如何,这就是问题所在:我已经启动并运行了nginx.它似乎可以正确提供网页.例如,基本网站http://www.shidenadvanced.com可以正常运行.但是,我位于http://www.shidenadvanced.com/test.php的php测试返回为空白.以前,它是作为502错误网关返回的.
通过研究,我了解到这意味着它无法正确地通过php-fpm进行路由.并非100%.
这是我的/ sites-available / config:
server {
server_name www.shidenadvanced.com shidenadvanced.com;
access_log /srv/sites/shidenadvanced/logs/access.log;
error_log /srv/sites/shidenadvanced/logs/error.log;
root /srv/sites/shidenadvanced/www;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.html;
}
#location ~ \.php${
# try_files $uri =404;
# include /etc/nginx/fastcgi_params;
# fastcgi_pass unix:/var/run/php-fpm5.sock;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /srv/sites/shidenadvanced/www$fastcgi_script_name;
#}
location ~ \.php${
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
除此以外,我不理会大多数设置.不能完全确定发生了什么.谁能阐明一些想法?
解决方法:
尝试这个.我对您处理fastcgi的方式做了一些更改
server {
server_name www.shidenadvanced.com shidenadvanced.com;
access_log /srv/sites/shidenadvanced/logs/access.log;
error_log /srv/sites/shidenadvanced/logs/error.log;
root /srv/sites/shidenadvanced/www;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.html;
}
# use fastcgi for all php files
location ~ \.php$
{
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
内容总结
以上是互联网集市为您收集整理的使用PHP5-FPM的Nginx-提供空白屏幕的.php文件全部内容,希望文章能够帮你解决使用PHP5-FPM的Nginx-提供空白屏幕的.php文件所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。