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

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

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

错误的配置如下 

1server { 2 listen 80; 3 server_name localhost; 4 5 #charset koi8-r; 6 #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脚本的端口吧, 改成 

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

评论区

加载中...

相关推荐

Nginx 调整文件上传大小限制

使用3A服务器做了网页,感觉挺不错的,使用LNMP环境用Nginx部署了前端,发现上传附件大一点就会报错,查看配置文件,发现spring的附件配置已经配置了。那么就看下Nginx的body设置。nginx文件上传默认是1MB。在server

完全卸载nginx及安装的详细步骤

前言在开局配置Nginx时有可能会配置错误,报各种错误代码。看不懂或者懒得去看这个报错时,其实最简单的方式是卸载并重装咯。今天就带大家一起学习下,如何彻底卸载nginx程序。一、卸载NGINX卸载nginx程序的详细步骤1、停止Nginx软件/usr/local/nginx/sbin/nginxsstop如果不知道nginx安装路径,可以通过执行ps命

NGINX的 IF AND 和 OR

if的逻辑用法什么是逻辑用法呢,就程序中的and、or关系,就叫做逻辑了.NGINX支持if的and与or或者&&与||吗?答案是No.当你尝试这样配置,重载nginx时,nginx会报出错误location/test/{default_typetext/html;

Nginx 反向代理Springboot oAuth https配置方案

Nginx配置方案server{listen80;server_namewww.yourname.com;rewrite^(.)$https://${server_name}$1permanent;}server{

LNMP架构中常见的502错误

1.配置错误因为nginx找不到phpfpm了,所以报错,一般是fastcgi\_pass后面的路径配置错误了,后面可以是socket或者是ip:port2.资源耗尽lnmp架构在处理php时,nginx直接调取后端的phpfpm服务,如果nginx的请求量偏高,我们又没有给phpfpm配置足够的子进程,那

Nginx提供下载apk服务

有时候我们可能需要提供文件或者其他apk下载链接,通过nginx配置可以很简单地实现。server{  listen80;  server_namedownload.xxx.com;  rootapp;  location/{    indexi

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