unit icon indicating copy to clipboard operation
unit copied to clipboard

web acess ip view "HTTP ERROR 502" ,nginx :9589#9589: signal 15 (SIGTERM) received from 11124, exiting

Open awmbtc opened this issue 3 years ago • 5 comments

nginx error log
[root@awmbtc ~]# tail /var/log/nginx/error.log 
2021/12/24 10:48:00 [notice] 9589#9589: signal 29 (SIGIO) received
2021/12/24 10:53:01 [notice] 9589#9589: signal 15 (SIGTERM) received from 11124, exiting
2021/12/24 10:53:01 [notice] 10252#10252: exiting
2021/12/24 10:53:01 [notice] 10252#10252: exit
2021/12/24 10:53:01 [notice] 10251#10251: exiting
2021/12/24 10:53:01 [notice] 10251#10251: exit
2021/12/24 10:53:01 [notice] 9589#9589: signal 17 (SIGCHLD) received from 10252
2021/12/24 10:53:01 [notice] 9589#9589: worker process 10252 exited with code 0
2021/12/24 10:53:01 [notice] 9589#9589: worker process 10251 exited with code 0
2021/12/24 10:53:01 [notice] 9589#9589: exit
unit log
[root@awmbtc ~]# tail /var/log/unit/unit.log
2021/12/24 10:54:41 [info] 1545#1545 "script_index_php" prototype started
2021/12/24 10:54:41 [info] 1546#1546 "script_index_php" application started
2021/12/24 10:54:41 [info] 1547#1547 "script_index_php" application started
2021/12/24 10:54:41 [info] 1548#1548 "script_index_php" application started
2021/12/24 10:54:41 [info] 1549#1549 "script_index_php" application started
2021/12/24 10:54:41 [info] 1550#1550 "script_index_php" application started
2021/12/24 10:54:41 [alert] 1229#1229 sendmsg(19, -1, -1, 1) failed (32: Broken pipe)
2021/12/24 10:54:41 [notice] 1229#1229 app process (isolated 1231) exited with code 0
2021/12/24 10:54:41 [notice] 1229#1229 app process (isolated 1230) exited with code 0
2021/12/24 10:54:41 [notice] 1192#1192 process 1229 exited with code 0

unit status

unit.service - NGINX Unit
   Loaded: loaded (/usr/lib/systemd/system/unit.service; enabled; vendor preset: disabled)
   Active: active (running) since Fri 2021-12-24 10:53:25 CST; 18min ago
 Main PID: 1192 (unitd)
    Tasks: 11 (limit: 23697)
   Memory: 31.5M
   CGroup: /system.slice/unit.service
           ├─1192 unit: main v1.26.1 [/usr/sbin/unitd --log /var/log/unit/unit.log --pid /run/unit/unit.pid --no-daemon]
           ├─1225 unit: controller
           ├─1226 unit: router
           ├─1545 unit: "script_index_php" prototype
           ├─1546 unit: "script_index_php" application
           ├─1547 unit: "script_index_php" application
           ├─1548 unit: "script_index_php" application
           ├─1549 unit: "script_index_php" application
           └─1550 unit: "script_index_php" application

Dec 24 10:53:25 awmbtc systemd[1]: Started NGINX Unit.
Dec 24 10:53:25 awmbtc unitd[1192]: 2021/12/24 10:53:25 [info] 1192#1192 unit 1.26.1 started
wordpress conf
{
    "listeners": {
        "127.0.0.1:8090": {
            "application": "script_index_php"
        },
        "127.0.0.1:8091": {
            "application": "direct_php"
        }
    },

    "applications": {
        "script_index_php": {
            "type": "php",
            "processes": {
                "max": 20,
                "spare": 5
            },
            "user": "nginx",
            "group": "nginx",
            "root": "/var/www/wordpress",
            "script": "index.php"
        },
        "direct_php": {
            "type": "php",
            "processes": {
                "max": 5,
                "spare": 0
            },
            "user": "nginx",
            "group": "nginx",
            "root": "/var/www/wordpress",
            "index": "index.php"
        }
    }
}
/etc/nginx/niginx.conf
user  nginx;
worker_processes  auto;

error_log  /var/log/nginx/error.log notice;
pid        /var/run/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;

    #gzip  on;

    include /etc/nginx/conf.d/*.conf;
}
/etc/nginx/conf.d/default.conf
upstream index_php_upstream {
    server 127.0.0.1:8090; # NGINX Unit backend address for index.php with
                           # 'script' parameter
}

upstream direct_php_upstream {
    server 127.0.0.1:8091; # NGINX Unit backend address for generic PHP file handling
}

server {
    listen      80;
    server_name localhost;
    root        /var/www/wordpress/;

    location / {
        try_files $uri @index_php;
    }

    location @index_php {
        proxy_pass       http://index_php_upstream;
        proxy_set_header Host $host;
    }

    location /wp-admin {
        index index.php;
    }

    location ~* .php$ {
        try_files        $uri =404;
        proxy_pass       http://direct_php_upstream;
        proxy_set_header Host $host;
    }
}

open page view 502 image

How do I fix this?

I've tried this several times, following the official nginx tutorials.

This is the second time I've done this, and after the first failure I reinstalled the host OS and redeployed all the applications, but the error is always there. Please help me out, thank you very much!

awmbtc avatar Dec 24 '21 03:12 awmbtc

add:/var/www/wordpress/wordpress.config

{ "listeners": { "127.0.0.1:8090": { "application": "script_index_php" }, "127.0.0.1:8091": { "application": "direct_php" } },

"applications": {
    "script_index_php": {
        "type": "php",
        "processes": {
            "max": 20,
            "spare": 5
        },
        "user": "nginx",
        "group": "nginx",
        "root": "/var/www/wordpress",
        "script": "index.php"
    },
    "direct_php": {
        "type": "php",
        "processes": {
            "max": 5,
            "spare": 0
        },
        "user": "nginx",
        "group": "nginx",
        "root": "/var/www/wordpress",
        "index": "index.php"
    }
}

}

awmbtc avatar Dec 24 '21 03:12 awmbtc

WX20211224-113731@2x WX20211224-113831@2x

/etc/nginx/niginx.conf WX20211224-113951@2x

/etc/nginx/conf.d/default.conf WX20211224-114058@2x

awmbtc avatar Dec 24 '21 03:12 awmbtc

Screenshot 2021-12-24 at 15 15 54

Please try to follow updated Wordpress HowTo.

mar0x avatar Dec 24 '21 12:12 mar0x

@awmbtc Hi. First of all, this error looks like neither from nginx, nor from Unit and I doubt that it can come from WordPress.

I suggest these steps:

  1. Verify that your request actually reaching your webserver at least by checking nginx access log
  2. Enable and provide debug log in Unit: https://unit.nginx.org/troubleshooting/#debug-log

VBart avatar Dec 25 '21 15:12 VBart

@awmbtc Also please provide the full logs, not just tail of them. Currently in your nginx logs only lines related to its shutdown are visible. Are you sure that your nginx is running?

VBart avatar Dec 25 '21 15:12 VBart