VPS侦探论坛

 找回密码
 注册
查看: 4448|回复: 7

lnmp1.4下Typecho出现502 Bad Gateway

[复制链接]
发表于 2018-4-28 12:10:40 | 显示全部楼层 |阅读模式

我已经看过了 [size=1.17em]LNMP一键安装包的Nginx 502 Bad Gateway错误可能原因及解决方法 那个帖子,但好像没有对应的情况,修改了一些配置也没有解决。我是个新手,百度谷歌也没找到该怎么办,所以就到这来求助了。下面是具体情况:
前段时间我的typecho网站一直能正常访问,但昨天发现打开网站就502 Bad Gateway了,并且部署在同一vps上的其他网站(如nextcloud)都能正常访问,只有typecho博客不行。我试过移出typecho所有文件,换上一个简单的index.html,能正常访问;删掉config.php重新上传typecho程序,重新安装,也是502 Bad Gateway。php探针显示vps内存使用率也正常。
关键是前段时间typecho博客一直能正常访问,现在就一直502了,我只发现了四天前vps在我不知情的情况下重启了一次,不知道是哪里出现了问题?
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
 楼主| 发表于 2018-4-29 11:44:48 | 显示全部楼层


需要我提供哪个log日志吗?
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2018-4-29 12:12:59 | 显示全部楼层

/usr/local/nginx/logs/errorr.log

2018/04/27 23:12:11 [notice] 1168#0: signal process started
2018/04/28 00:12:51 [notice] 1844#0: signal process started
2018/04/28 00:46:41 [notice] 962#0: signal process started
2018/04/28 01:16:05 [notice] 1601#0: signal process started
2018/04/28 09:52:50 [notice] 1692#0: signal process started
2018/04/28 10:01:36 [notice] 2270#0: signal process started
2018/04/28 10:13:28 [notice] 2841#0: signal process started
2018/04/28 10:17:42 [notice] 3421#0: signal process started
2018/04/28 10:19:39 [emerg] 3984#0: invalid number of arguments in "include" directive in /usr/local/nginx/conf/vhost/我的域名.conf:25
2018/04/28 10:29:42 [notice] 4548#0: signal process started
2018/04/28 11:07:26 [notice] 5127#0: signal process started
2018/04/29 12:08:41 [notice] 5823#0: signal process started

然后“我的域名.conf文件” 25行是
include enable-php-pathinfo.conf;
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2018-4-29 16:27:48 | 显示全部楼层



贴完整配置看一下,另外enable-php-pathinfo.conf也贴一下
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2018-4-29 20:12:48 | 显示全部楼层

/usr/local/nginx/conf/vhost/我的域名.conf

server
    {
        listen 80;
        #listen [::]:80;
        server_name 我的域名 ;
        index index.html index.htm index.php default.html default.htm default.php;
        root  /home/wwwroot/我的域名;

       include typecho.conf

        if (!-e $request_filename) {
            rewrite ^(.*)$ /index.php$1 last;
        }

        location ~ .*\.php(\/.*)*$ {
            include fastcgi.conf;
            fastcgi_pass  127.0.0.1:9000;
        }

        #error_page   404   /404.html;

        # Deny access to PHP files in specific directory
        #location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }

        include enable-php-pathinfo.conf;

        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
        {
            expires      30d;
        }

        location ~ .*\.(js|css)?$
        {
            expires      12h;
        }

        location ~ /.well-known {
            allow all;
        }

        location ~ /\.
        {
            deny all;
        }

        access_log  /home/wwwlogs/我的域名.log;
    }

军哥运维代购:http://shop63846532.taobao.com/

 楼主| 发表于 2018-4-29 20:15:11 | 显示全部楼层

/usr/local/nginx/conf/enable-php-pathinfo.conf

        location ~ [^/]\.php(/|$)
        {
            fastcgi_pass  unix:/tmp/php-cgi.sock;
            fastcgi_index index.php;
            include fastcgi.conf;
            include pathinfo.conf;
        }
 楼主| 发表于 2018-4-29 20:22:43 | 显示全部楼层

不好意思,我尝试把 /usr/local/nginx/conf/vhost/我的域名.conf 里的
if (!-e $request_filename) {
            rewrite ^(.*)$ /index.php$1 last;
        }

        location ~ .*\.php(\/.*)*$ {
            include fastcgi.conf;
            fastcgi_pass  127.0.0.1:9000;
        }

用#注释掉,重启lnmp,网站又能正常访问了。但是原来不用注释也能正常访问,不知道是为什么?

如果您不清楚也没关系,毕竟问题好像已经解决了,感谢军哥

[ 本帖最后由 Lussac 于 2018-4-29 20:23 编辑 ]
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2018-4-30 09:22:19 | 显示全部楼层

回复 7# 的帖子


lnmp是socket连接,你改成端口肯定502,置顶帖的排查帖子肯定也是没仔细看
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|VPS侦探 ( 鲁ICP备16040043号-1 )

GMT+8, 2024-9-24 07:15 , Processed in 0.027721 second(s), 16 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表