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

Stella981
• 阅读 515

查看了进程, 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, 遇到很多问题, 记录之
点赞
收藏
评论区
推荐文章
芝士年糕 芝士年糕
1年前
Nginx 调整文件上传大小限制
使用3A服务器做了网页,感觉挺不错的,使用LNMP环境用Nginx部署了前端,发现上传附件大一点就会报错,查看配置文件,发现spring的附件配置已经配置了。那么就看下Nginx的body设置。nginx文件上传默认是1MB。在server
DevOpSec DevOpSec
3年前
NGINX的 IF AND 和 OR
if的逻辑用法什么是逻辑用法呢,就程序中的and、or关系,就叫做逻辑了.NGINX支持if的and与or或者&&与||吗?答案是No.当你尝试这样配置,重载nginx时,nginx会报出错误location/test/{default_typetext/html;
芝士年糕 芝士年糕
1年前
完全卸载nginx及安装的详细步骤
前言在开局配置Nginx时有可能会配置错误,报各种错误代码。看不懂或者懒得去看这个报错时,其实最简单的方式是卸载并重装咯。今天就带大家一起学习下,如何彻底卸载nginx程序。一、卸载NGINX卸载nginx程序的详细步骤1、停止Nginx软件/usr/local/nginx/sbin/nginxsstop如果不知道nginx安装路径,可以通过执行ps命
Stella981 Stella981
2年前
Nginx 502 Bad Gateway 的错误的解决方案
我用的是nginx反向代理Apache,直接用Apache不会有任何问题,加上nginx就会有部分ajax请求502的错误,下面是我收集到的解决方案。一、fastcgi缓冲区设置过小 出现错误,首先要查找nginx的日志文件,目录为/var/log/nginx,在日志中发现了如下错误 2013/01/1713:33:47\err
Stella981 Stella981
2年前
Nginx 反向代理Springboot oAuth https配置方案
Nginx配置方案server{listen80;server_namewww.yourname.com;rewrite^(.)$https://${server_name}$1permanent;}server{
Wesley13 Wesley13
2年前
LNMP架构中常见的502错误
1.配置错误因为nginx找不到phpfpm了,所以报错,一般是fastcgi\_pass后面的路径配置错误了,后面可以是socket或者是ip:port2.资源耗尽lnmp架构在处理php时,nginx直接调取后端的phpfpm服务,如果nginx的请求量偏高,我们又没有给phpfpm配置足够的子进程,那
Stella981 Stella981
2年前
Nginx提供下载apk服务
有时候我们可能需要提供文件或者其他apk下载链接,通过nginx配置可以很简单地实现。server{  listen80;  server_namedownload.xxx.com;  rootapp;  location/{    indexi
Stella981 Stella981
2年前
Nginx SSL补充安装
在centos中,配置nginx的https时,出现如下错误。nginx:\emerg\unknowndirective"ssl"in/usr/local/nginx/conf/nginx.conf:102,说明编译是没有启用SSL。到解压的nginx目录下./configurewith
Stella981 Stella981
2年前
Nginx配置参数中文详细说明
Nginx配置参数中文详细说明定义Nginx运行的用户和用户组userwwwwww;nginx进程数,建议设置为等于CPU总核心数.worker_processes8;全局错误日志定义类型,debug|info|notice|
Stella981 Stella981
2年前
Nginx 的 location 匹配规则
约定本文以Nginx1.17.6主线版为准。引言location是Nginx配置中的重要一环,用来配置动静分离、反向代理等功能。而location匹配规则,网上有太多错误的说法,今予以纠正并给出正确规则描述。最常见的错误最常见的错误之一,就是认为^~的优先级高于~,但实际上,我们