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

目录 Linux
Nginx报错:Sorry, the page you are looking for is currently unavailable. Please try again later.-下一朵云
图1 Nginx报错处理

Nginx源码编译安装,php7.1源码编译安装,nginx配置域名虚拟主机后,访问html页面正常,访问php页面时会有报错提醒:

Nginx报错:Sorry, the page you are looking for is currently unavailable. Please try again later.-下一朵云
图2 访问报错

查询nginx虚拟主机配置,确认正确,配置文件如下:

##conf/vhost    
server {
        listen       80;
        server_name  my.orcy.net.cn;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;
        access_log  logs/my.orcy.net.cn.log  main;
        error_log  logs/my.orcy.net.cn.error.log;	

        location / {
            root   /srv/www/html;
            index  index.php index.html index.htm;
        }


 location ~ \.php$ {
           root	/srv/www/html;
           fastcgi_pass   127.0.0.1:9000;
           fastcgi_index  index.php;
           fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
           include        fastcgi_params;
        }
        error_page  404              /404.html;
        location = /404.html {
            root   html;
        }

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
}

查看nginx错误日志:error_log logs/my.orcy.net.cn.error.log

[error] 11560#0: *3 connect() failed (111: Connection refused) while connecting to upstream, client: 10.24.10.19, server: my.orcy.net.cn, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "my.orcy.net.cn"

确认应该是php-fpm未正常运行,查看php-fpm状态

#ps aux|grep php-fpm
Nginx报错:Sorry, the page you are looking for is currently unavailable. Please try again later.-下一朵云
图3 查看php-fpm进程

果然是,php-fpm服务未正常运行,手动启动php-fpm

Nginx报错:Sorry, the page you are looking for is currently unavailable. Please try again later.-下一朵云
图4 启动php-fpm

网页访问正常,问题解决,如下图,但是php-fpm无法后台运行,退出或crtl+c会导致php-fpm结束,如何让php-fpm后台运行,请查看《 启动php-fpm无法后台运行,退出或crtl+c会导致php-fpm结束解决办法 》

Nginx报错:Sorry, the page you are looking for is currently unavailable. Please try again later.-下一朵云
图5 正常访问

nginx虚拟主机配置文件下载

nginx+php虚拟主机配置文件: https://download.csdn.net/download/i12344/12244635