WAF API nginx[1768]: nginx: [emerg] bind() to 0.0.0.0:8080 failed (98: Address already in use)

MaxRAF

Member
Здравствуйте.

У меня nginx.conf такой:
NGINX:
user  apache;
load_module /etc/nginx/modules/ngx_http_waf_module.so;
worker_processes  1;

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


events {
    worker_connections  1024;
}


http {
    ##
    # Nemesida WAF
    ##

    ## Request body too large fix
    client_body_buffer_size 25M;

    include /etc/nginx/nwaf/conf/global/*.conf;
    include /etc/nginx/nwaf/conf/vhosts/*.conf;

    log_format ispmgrnode '$server_name $request_length $bytes_sent';
    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;
        include /etc/nginx/conf.d/masterproxy.d/*.conf;
        include /etc/nginx/vhosts/*/*.conf;
server {
        server_name max-ko.site;
 disable_symlinks if_not_owner;
        include /etc/nginx/vhosts-includes/*.conf;
        location @fallback {
                error_log /dev/null crit;
                proxy_pass http://127.0.0.1:8080;
                proxy_redirect http://127.0.0.1:8080 /;
                proxy_set_header Host $host;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header X-Forwarded-Proto $scheme;
        }
        listen 80;
        listen [::]:80;
        listen 95.216.212.203:80 default_server;
    }
server {
        server_name max-ko.site;
 disable_symlinks if_not_owner;
        include /etc/nginx/vhosts-includes/*.conf;
        location @fallback {
                error_log /dev/null crit;
                proxy_pass http://127.0.0.1:8080;
                proxy_redirect http://127.0.0.1:8080 /;
                proxy_set_header Host $host;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header X-Forwarded-Proto $scheme;
        }
        add_header Strict-Transport-Security "max-age=31536000;";
        listen 95.216.212.203:443 ssl default_server;
        ssl_certificate "/usr/local/mgr5/etc/nginx_certs/default_srv.crtca";
        ssl_certificate_key "/usr/local/mgr5/etc/nginx_certs/default_srv.key";
        ssl_ciphers EECDH:+AES256:-3DES:RSA+AES:!NULL:!RC4;
        ssl_prefer_server_ciphers on;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    }
        client_max_body_size 128m;
}
Следовательно Apache (httpd) использует 8080/tcp:
Bash:
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:993             0.0.0.0:*               LISTEN      1495/dovecot
tcp        0      0 0.0.0.0:995             0.0.0.0:*               LISTEN      1495/dovecot
tcp        0      0 127.0.0.1:9000          0.0.0.0:*               LISTEN      934/php-fpm: master
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      1439/mysqld
tcp        0      0 0.0.0.0:587             0.0.0.0:*               LISTEN      951/exim
tcp        0      0 0.0.0.0:110             0.0.0.0:*               LISTEN      1495/dovecot
tcp        0      0 0.0.0.0:143             0.0.0.0:*               LISTEN      1495/dovecot
tcp        0      0 127.0.0.1:783           0.0.0.0:*               LISTEN      1094/spamd.pid -d -
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      550/rpcbind
tcp        0      0 127.0.0.1:8080          0.0.0.0:*               LISTEN      945/httpd
tcp        0      0 0.0.0.0:465             0.0.0.0:*               LISTEN      951/exim
tcp        0      0 0.0.0.0:53              0.0.0.0:*               LISTEN      1533/pdns_server
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1435/sshd
tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN      951/exim
tcp        0      0 95.216.212.203:1500     0.0.0.0:*               LISTEN      1476/ihttpd

Когда устанавливается WAF API, то создается файл nwaf-api.conf, который должен слушать 8080/tcp, но после перезапуска nginx получаю закономерный:
Bash:
Oct 05 08:55:27 centos-2gb-hel1-1 nginx[2365]: nginx: [emerg] bind() to 0.0.0.0:8080 failed (98: Address already in use)
Oct 05 08:55:28 centos-2gb-hel1-1 nginx[2365]: nginx: [emerg] bind() to 0.0.0.0:8080 failed (98: Address already in use)
Oct 05 08:55:28 centos-2gb-hel1-1 nginx[2365]: nginx: [emerg] bind() to 0.0.0.0:8080 failed (98: Address already in use)
Oct 05 08:55:29 centos-2gb-hel1-1 nginx[2365]: nginx: [emerg] bind() to 0.0.0.0:8080 failed (98: Address already in use)
Oct 05 08:55:29 centos-2gb-hel1-1 nginx[2365]: nginx: [emerg] bind() to 0.0.0.0:8080 failed (98: Address already in use)
Oct 05 08:55:30 centos-2gb-hel1-1 nginx[2365]: nginx: [emerg] still could not bind()
Oct 05 08:55:30 centos-2gb-hel1-1 systemd[1]: nginx.service: control process exited, code=exited status=1
Oct 05 08:55:30 centos-2gb-hel1-1 systemd[1]: Failed to start nginx - high performance web server.
Oct 05 08:55:30 centos-2gb-hel1-1 systemd[1]: Unit nginx.service entered failed state.
Oct 05 08:55:30 centos-2gb-hel1-1 systemd[1]: nginx.service failed.
Как быть в этой ситуации?
 

support

Active member
Staff member
Добрый день,

вы можете назначить для Nemesida WAF API другой свободный порт.
 
Top