502 Bad Gateway nginx nginx.conf配置文件嵌套(排查)

 vim /usr/local/nginx/conf/nginx.conf

include vhost/*.conf;

 find / -name vhost

cd /usr/local/nginx/conf/vhost

ls

www.xxxxxxx.com.conf

cat   www.xxxxxxx.com.conf

server
    {
        listen 80;
        #listen [::]:80;
        server_name www.xxxxxxx.com xxxxxx.com www.xxxxxxx.com;
        index index.html index.htm index.php default.html default.htm default.php;
        root  /home/wwwroot/xxxxxx;

        include none.conf;
        #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.conf;

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

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

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

        location ~ /\.
        {
            client_max_body_size    1000m;
            deny all;
        }
 
        access_log  /home/wwwlogs/www.xxxxxx.com.log;
    }
server {
    listen 80;
    server_name  xxxx.com;
    return 301 http://xxxxxx.com$request_uri;
}
server {
  #  listen 80;
 #   server_name  xn--fctr65eu6lgd.com;
#    return 301 http://xxxxxx.com$request_uri;
}

排查

排查:

1、磁盘空间占用情况

[root~]#

[root~]# df  -h

Filesystem      Size  Used Avail Use% Mounted on

/dev/vda1        40G   13G   26G  33% /

devtmpfs        1.9G     0  1.9G   0% /dev

tmpfs           1.9G     0  1.9G   0% /dev/shm

tmpfs           1.9G  360K  1.9G   1% /run

tmpfs           1.9G     0  1.9G   0% /sys/fs/cgroup

tmpfs           380M     0  380M   0% /run/user/0

[root~]#

2、内存占用情况

[root~]# free -h

              total        used        free      shared  buff/cache   available

Mem:           3.7G        1.2G        124M        404K        2.4G        2.2G

Swap:            0B          0B          0B

[root~]#

3、服务

[root~]# systemctl status php-fpm

● php-fpm.service - LSB: starts php-fpm

   Loaded: loaded (/etc/rc.d/init.d/php-fpm; bad; vendor preset: disabled)

   Active: active (running) since Tue 2019-04-30 16:29:57 CST; 4 days ago

     Docs: man:systemd-sysv-generator(8)

  Process: 12907 ExecStop=/etc/rc.d/init.d/php-fpm stop (code=exited, status=0/SUCCESS)

  Process: 12912 ExecStart=/etc/rc.d/init.d/php-fpm start (code=exited, status=0/SUCCESS)

[root~]# ss  -tnulp|grep nginx

tcp    LISTEN     0      128       *:80                    *:*                   users:(("nginx",pid=13068,fd=8),("nginx",pid=13067,fd=8),("nginx",pid=13066,fd=8))

[root~]# ss  -tnulp|grep 3306    

tcp    LISTEN     0      50        *:3306                  *:*                   users:(("mysqld",pid=9068,fd=11))

[root~]# nginx -t

nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok

nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful

tailf  /home/wwwlogs/xxxxxxx.com.log

以上1、2、3、查看了磁盘、内存、服务的使用情况。请协助排查代码问题。

猜你喜欢

转载自blog.csdn.net/weixin_40018205/article/details/89849455