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)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • SpringBatch概述

    SpringBatch概述1、SpringBatch简介1.1、简介根据Spring官网描述,SpringBatch是一个轻量级的、完善的批处理应用框架,旨在支持企业系统建立健壮、高效的批处理应用。然而SpringBatch不是一个调度框架,它只关注于任务的处理,如日志监控、事务、并发问题等,但是它可以与其它调度框架一起联合使用,完成相应的调度任务,如Quartz、Tivoli、Control-M等。Sprin…

    2022年5月8日
    50
  • kali apk免杀_kali攻击windows

    kali apk免杀_kali攻击windows首先,介绍一下VeilEvasion,VeilEvasion是linux的一款免杀工具,是一个用Python编写的免杀框架,用来生成MSF的Payload,能绕过常见的杀毒软件,它可以将任意脚本或一段Shellcode转换成Windows可执行文件,从而逃避常见防病毒产品的检测。关于MSF,它就是一个漏洞框架(全称:TheMetasploitFramework),嗯,免费,通过这个框架,我们可以很容易的对于软件的漏洞进行攻击。它本身带有几千个漏洞攻击工具。……

    2022年8月20日
    6
  • mysql 加入�列,改动列,删除列。

    mysql 加入�列,改动列,删除列。

    2021年12月1日
    36
  • Linux 多学习过程

    Linux 多学习过程

    2022年1月5日
    51
  • Java8新特性学习之一:lambda表达式入门

    Java8新特性学习之一:lambda表达式入门

    2021年8月3日
    70
  • ws 激活码2021【永久激活】

    (ws 激活码2021)2021最新分享一个能用的的激活码出来,希望能帮到需要激活的朋友。目前这个是能用的,但是用的人多了之后也会失效,会不定时更新的,大家持续关注此网站~IntelliJ2021最新激活注册码,破解教程可免费永久激活,亲测有效,下面是详细链接哦~https://javaforall.net/100143.html…

    2022年3月20日
    284

发表回复

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

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