查看了进程, nginx, php-fpm都在运行, 排除程序错误, 那么就是配置的问题了.

一个可能的错误, 是由于配置中的 fastcgi_pass 配置错了

错误的配置如下

  1. server {
  2. listen 80;
  3. server_name localhost;
  4.  
  5. #charset koi8-r;
  6. #access_log /var/log/nginx/log/host.access.log main;
  7.  
  8. location ~ \.php$ {
  9. root /usr/share/nginx/html;
  10. fastcgi_pass 127.0.0.1:80;
  11. fastcgi_index index.php;
  12. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  13. include fastcgi_params;
  14. index index.php;
  15. }
  16.  
  17. location / {
  18. root /usr/share/nginx/html;
  19. index index.html;
  20. }
  21.  
  22. #error_page 404 /404.html;
  23.  
  24. # redirect server error pages to the static page /50x.html
  25. #
  26. error_page 500 502 503 504 /50x.html;
  27. location = /50x.html {
  28. root /usr/share/nginx/html;
  29. }
  30.  
  31. # proxy the PHP scripts to Apache listening on 127.0.0.1:80
  32. #
  33. #location ~ \.php$ {
  34. # proxy_pass http://127.0.0.1;
  35. #}
  36.  
  37. # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
  38. #
  39. #location ~ \.php$ {
  40. # root html;
  41. # fastcgi_pass 127.0.0.1:9000;
  42. # fastcgi_index index.php;
  43. # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
  44. # include fastcgi_params;
  45. #}
  46.  
  47. # deny access to .htaccess files, if Apache's document root
  48. # concurs with nginx's one
  49. #
  50. #location ~ /\.ht {
  51. # deny all;
  52. #}
  53. }

标红的地方, 我以为是端口, 但是不是, 具体应该是 php-fpm 处理php脚本的端口吧, 改成

  1. fastcgi_pass 127.0.0.1:9000; 就好了
  2.  
  3. 还有一个问题, 访问PHP可以访问了, 但是访问html不能访问, 是因为 蓝色标识的未添加, 就是下面这段
  1. location / {
  2. root /usr/share/nginx/html;
  3. index index.html;
  4. }
  5.  
  6. 第一次搞nginx, 遇到很多问题, 记录之

Nginx报错:Sorry, the page you are looking for is currently unavailable. Please try again later.的更多相关文章

  1. nginx 报错 upstream timed out (110: Connection timed out)解决方案【转】

    转自 nginx 报错 upstream timed out (110: Connection timed out)解决方案 - 为程序员服务http://outofmemory.cn/code-sn ...

  2. nginx报错:./configure: error: C compiler cc is not found, gcc 是已经安装了的

    源码安装nginx报错,找不到gcc,但是实际上gcc是存在的,如下: # ./configure checking for OS + Linux -.el7.x86_64 x86_64 checki ...

  3. 新建SpringBoot项目运行页面报错Whitelabel Error Page This application has no explicit mapping for /error, so yo

    新建SpringBoot项目运行页面报错Whitelabel Error Page This application has no explicit mapping for /error, so yo ...

  4. nginx报错zero size shared memory zone one

    为了限速,在虚拟主机中加上了一个参数:limit_conn one 1:结果导致重启nginx报错: zero size shared memory zone "one"解决办法是 ...

  5. nginx报错:403 Forbidden 并且访问首页index.php是下载文件的状态

    nginx报错:403 Forbidden 并且访问首页index.php是下载文件的状态,不能正常解析php 系统有其他两个站访问是正常的 看日志没有看到明显的错误 搜索了下: 答案如下: php的 ...

  6. springboot报错Whitelabel Error Page

    第一次使用springboot没有问题.隔了两天继续看.一直报错Whitelabel Error Page. 重新搭建试了任何方法都错了. 报的就是一个404错误,犯了一个习惯性错误,一般都是loca ...

  7. Centos下yum安装Nginx报错 No package nginx available.

    在Centos6下使用yum安装Nginx报错 解决方案: yum install epel-release

  8. 初学 Spring boot 报错 Whitelabel Error Page 404

    按照教程,写了个最简单的 HelloWorld,尼玛报错 -->Whitelabel Error Page 404. 网上99%都是项目结构不对,说什么 Application放在父级 pack ...

  9. 安装Nginx报错“Cannot retrieve metalink for repository: epel. Please verify its path and try again”

    CentOS 6.5中通过yum安装nginx报错. 搜了一下,很多都是修改某个配置文件的.但是在StackOverFlow的某个问题下,有人回答说修改配置文件并不是一个好的方法,虽然我采用了这个人的 ...

  10. nginx报错:nginx: [emerg] unknown directive in /etc/nginx/conf.d/test.conf:4

    nginx报错:nginx: [emerg] unknown directive  in /etc/nginx/conf.d/test.conf:4 解决: 第四行出现了 tab 空格 , 换成正常的 ...

随机推荐

  1. jQuery 树形结构

    强大的jquery.ztree树形菜单插件支持多种树形菜单导航 http://www.17sucai.com/pins/2259.html 演示: http://www.17sucai.com/pin ...

  2. xgboost中如何自定义metric(python中)

    正好在参加携程的比赛,用的xgboost的算法,但携程比赛的测评函数比较奇怪,不是传统的那些,而是取precision≥0.97的情况下,recall的最大值.那无疑这个测评函数是要自己写的(官方没给 ...

  3. 独家分享——大牛教你如何学习Web前端开发

    2014-12-18 14:35:42     引语 自从2008年接触网站开发以来到现在已经有六个年头了,今天偶然整理电脑资料看到当时为参加系里面一个比赛而做的第一个网站时,勾起了在这网站开发道路上 ...

  4. Python的subprocess模块

    尝试在Python中运行可执行文件,网上给出的解决方案是: import os os.system("此处填程序路径") 我要运行的程序文件名中有空格,因此果断失败了,查看了一下帮 ...

  5. Unity问答——怎么知道屏幕中目前有多少个敌人?

    这篇博客源自我在泰课在线的回答.链接:http://www.taikr.com/group/1/thread/92 问:怎么知道屏幕中目前有多少个敌人? 答: 思路一:仅适用于2D游戏,因为这个方法没 ...

  6. Google为何这么屌

    概述: 在移动市场上,从来没有一个公司像Google一样的玩法,以后可能也不会有.因为这根本就不是一个商业模式.它可以调动极大的资源而几乎没有盈利压力,它力逾千钧又身段灵活.它从来不尊重这个市场原有的 ...

  7. GNU project C

    gcc - GNU project C and C++ compiler   gcc [option] file...            preprocessing         compila ...

  8. Why GEMM is at the heart of deep learning

    Why GEMM is at the heart of deep learning I spend most of my time worrying about how to make deep le ...

  9. Java 可视化垃圾回收

    基础 当谈到释放不再使用的内存,垃圾回收已经在很大程度上取代了早期技术,比如手动内存管理和引用计数. 这是件好事,因为内存管理令人厌烦,学究式地簿记是计算机擅长的,而不是人擅长的.在这方面,语言的运行 ...

  10. 连接各种数据库神器———DbVisualizer

    作为开发人员,经常会遇到在不同的数据库环境中进行开发或者调试,所以针对每种数据库都要安装对应的客户端,不但要占用硬盘控件而且还要经常切换,无可厚非这是一项头疼并且麻烦的事情.有了DbVisualize ...