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

博客展示了Nginx配置文件的编辑与查看,包含多个server块的配置。同时对系统进行排查,查看了磁盘空间占用、内存占用情况,以及php - fpm、nginx、mysql等服务状态,最后查看了日志文件,希望协助排查代码问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 

 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、查看了磁盘、内存、服务的使用情况。请协助排查代码问题。

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

乐于技术分享

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值