Nginx报错:Sorry, the page you are looking for is currently unavailable. Please try again later.

Nginx报错:Sorry, the page you are looking for is currently unavailable. Please try again later.

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

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

错误的配置如下 

 
server {
    listen       80; server_name localhost; #charset koi8-r; #access_log /var/log/nginx/log/host.access.log main;  location ~ \.php$ { root /usr/share/nginx/html; fastcgi_pass 127.0.0.1:80; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; index index.php; } location / { root /usr/share/nginx/html; index index.html; } #error_page 404 /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; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # #location ~ \.php$ { # root html; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; # include fastcgi_params; #} # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #} }
 

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

fastcgi_pass 127.0.0.1:9000; 就好了 

还有一个问题, 访问PHP可以访问了, 但是访问html不能访问, 是因为 蓝色标识的未添加, 就是下面这段
location / { 
        root /usr/share/nginx/html;
        index index.html;
    }

第一次搞nginx, 遇到很多问题, 记录之

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/112860.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • maven-porm.xml详解

    maven-porm.xml详解什么是POM?POM是项目对象模型(ProjectObjectModel)的简称,它是Maven项目中的文件,使用XML表示,名称叫做pom.xml。作用类似ant的build.xml文件,功能更强大。该文件用于管理:源代码、配置文件、开发者的信息和角色、问题追踪系统、组织信息、项目授权…

    2022年6月15日
    25
  • VBoxManage安装

    VBoxManage安装扩展包的版本需要与VirtualBox的版本一致,通过帮助可以查看VirtualBox的版本信息,然后在http://download.virtualbox.org/virtualbox/寻找对应的版本。接下来执行安装命令[root@root下载]#VBoxManageextpackinstall./Oracle_VM_VirtualBox_Extension_Pack…

    2022年6月11日
    50
  • libsvm工具箱C++编程实践2

    libsvm工具箱C++编程实践2

    2022年1月8日
    45
  • opengl和directx渲染有什么区别(directx怎么打开)

    原文地址:http://tieba.baidu.com/p/2018728460?see_lz=1OpenGL只是图形函数库。 DirectX包含图形,声音,输入,网络等模块。 单就图形而论,DirectX的图形库性能不如OpenGL OpenGL稳定,可跨平台使用。但OpenGL多需要显卡支持. ———————————-…

    2022年4月13日
    139
  • 乌云漏洞平台官网_bug漏洞平台

    乌云漏洞平台官网_bug漏洞平台前期准备乌云资源文件下载地址:https://github.com/m0l1ce/wooyunallbugs将下载的乌云数据库文件、网页等内容全部下载下来,最终内容如下phpstudy下载:https://www.xp.cn/download.html下载phpstudy,目前最新版本是V8.1,直接安装就可以。环境搭建创建网站首先创建一个自己喜欢的域名,注意PHP版本需要是5.3的版本,默认的7版本不支持相关的语法。第二个域名设置为static.loner.fm将bugs.rar解

    2022年10月23日
    0
  • C++隐藏规则

    在面向对象的开发过程中,经常出现类的继承,这里面出现的成员函数的重载(overload)、覆盖(override)与隐藏(hidden)很容易混淆。首先澄清这3个概念:重载覆盖(派生类函数覆盖基

    2021年12月22日
    49

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号