is nginx has a limit for domain ?

April 30, 2019 284 views
Nginx

Hi ,

I have a web server with nginx and I have a round 1017 domain works on it ,

I’m using forge service to create a new domain and ssl certification , but now I can’t add any new domain

if I add a new domain I got nginx an error :
nginx.service failed because a configured resource limit was exceeded

my nginx configration :
user forge;
worker_processes auto;
worker_rlimit_nofile 65530;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
        worker_connections 65535;
        multi_accept on;
}

http {
        ##
        client_body_timeout 25s;
        # Basic Settings
        ##
        sendfile on;
        tcp_nopush on;
        tcp_nodelay on;
        keepalive_timeout 30;
        types_hash_max_size 2048;
        server_tokens off;

        server_names_hash_bucket_size 2048;
        # server_name_in_redirect off;

can anyone help me with this issue .

thank you

3 Answers
jarland MOD April 30, 2019
Accepted Answer

Greetings!

It seems that Nginx isn’t immediately giving away useful information in that error. The key will be digging to find something more descriptive. You can try this to see if anything looks relevant:

journalctl -xn --no-pager

You could also try tailing the Nginx log, which is most likely this:

tail /var/log/nginx/error.log

It’s hard to say exactly what you’re looking for, you may know it when you see it.

Jarland

  • thank you so much for your reply

    here is the output

    journalctl -xn –no-pager
    – Logs begin at Mon 2019-04-29 15:50:51 UTC, end at Tue 2019-04-30 21:39:13 UTC. –
    Apr 30 21:37:13 gorgeous-summit kernel: [UFW BLOCK] IN=eth1 OUT= MAC=ea:a7:d1:7d:a2:dc:92:22:d5:df:ce:32:08:00 SRC=10.135.130.4 DST=10.135.43.95 LEN=60 TOS=0x00 PREC=0x00 TTL=64 ID=41661 DF PROTO=TCP SPT=52740 DPT=6556 WINDOW=29200 RES=0x00 SYN URGP=0
    Apr 30 21:37:55 gorgeous-summit kernel: [UFW BLOCK] IN=eth0 OUT= MAC=62:83:8d:6e:dd:fb:40:a6:77:4f:3f:f0:08:00 SRC=223.99.60.46 DST=207.154.206.205 LEN=40 TOS=0x04 PREC=0x60 TTL=243 ID=54321 PROTO=TCP SPT=53583 DPT=8080 WINDOW=65535 RES=0x00 SYN URGP=0
    Apr 30 21:38:12 gorgeous-summit kernel: [UFW BLOCK] IN=eth1 OUT= MAC=ea:a7:d1:7d:a2:dc:92:22:d5:df:ce:32:08:00 SRC=10.135.130.4 DST=10.135.43.95 LEN=60 TOS=0x00 PREC=0x00 TTL=64 ID=15940 DF PROTO=TCP SPT=52758 DPT=6556 WINDOW=29200 RES=0x00 SYN URGP=0
    Apr 30 21:38:13 gorgeous-summit kernel: [UFW BLOCK] IN=eth1 OUT= MAC=ea:a7:d1:7d:a2:dc:92:22:d5:df:ce:32:08:00 SRC=10.135.130.4 DST=10.135.43.95 LEN=60 TOS=0x00 PREC=0x00 TTL=64 ID=15941 DF PROTO=TCP SPT=52758 DPT=6556 WINDOW=29200 RES=0x00 SYN URGP=0
    Apr 30 21:38:38 gorgeous-summit kernel: [UFW BLOCK] IN=eth0 OUT= MAC=62:83:8d:6e:dd:fb:40:a6:77:34:67:f0:08:00 SRC=77.42.106.115 DST=207.154.206.205 LEN=44 TOS=0x00 PREC=0x00 TTL=51 ID=3651 PROTO=TCP SPT=61644 DPT=23 WINDOW=50940 RES=0x00 SYN URGP=0
    Apr 30 21:39:01 gorgeous-summit systemd[1]: Starting Clean php session files…
    – Subject: Unit phpsessionclean.service has begun start-up
    – Defined-By: systemd

    – Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel

    – Unit phpsessionclean.service has begun starting up.
    Apr 30 21:39:01 gorgeous-summit sessionclean[13966]: PHP Warning: Module ‘blackfire’ already loaded in Unknown on line 0
    Apr 30 21:39:04 gorgeous-summit systemd[1]: Started Clean php session files.
    – Subject: Unit phpsessionclean.service has finished start-up
    – Defined-By: systemd

    – Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel – Unit phpsessionclean.service has finished starting up.

    – The start-up result is done.
    Apr 30 21:39:12 gorgeous-summit kernel: [UFW BLOCK] IN=eth1 OUT= MAC=ea:a7:d1:7d:a2:dc:92:22:d5:df:ce:32:08:00 SRC=10.135.130.4 DST=10.135.43.95 LEN=60 TOS=0x00 PREC=0x00 TTL=64 ID=17620 DF PROTO=TCP SPT=52776 DPT=6556 WINDOW=29200 RES=0x00 SYN URGP=0
    Apr 30 21:39:13 gorgeous-summit kernel: [UFW BLOCK] IN=eth1 OUT= MAC=ea:a7:d1:7d:a2:dc:92:22:d5:df:ce:32:08:00 SRC=10.135.130.4 DST=10.135.43.95 LEN=60 TOS=0x00 PREC=0x00 TTL=64 ID=17621 DF PROTO=TCP SPT=52776 DPT=6556 WINDOW=29200 RES=0x00 SYN URGP=0

    tail /var/log/nginx/error.log
    2019/04/30 21:32:23 [alert] 11150#11150: socketpair() failed while spawning “worker process” (24: Too many open files)
    2019/04/30 21:32:23 [alert] 11150#11150: socketpair() failed while spawning “worker process” (24: Too many open files)
    2019/04/30 21:32:23 [alert] 11150#11150: socketpair() failed while spawning “worker process” (24: Too many open files)
    2019/04/30 21:32:23 [alert] 11150#11150: socketpair() failed while spawning “worker process” (24: Too many open files)
    2019/04/30 21:32:23 [alert] 11150#11150: socketpair() failed while spawning “worker process” (24: Too many open files)
    2019/04/30 21:32:23 [alert] 11150#11150: socketpair() failed while spawning “worker process” (24: Too many open files)
    2019/04/30 21:32:47 [notice] 11276#11276: signal process started
    2019/04/30 21:32:48 [emerg] 11150#11150: open() “/etc/nginx/nginx.conf” failed (24: Too many open files)
    2019/04/30 21:33:10 [emerg] 13945#13945: open(“/dev/null”) failed (24: Too many open files)
    2019/04/30 21:36:44 [emerg] 13964#13964: open(“/dev/null”) failed (24: Too many open files)

I found a solution .

1- find the pid of nginx master process

ps ux | grep -i nginx

2- then edit the process id limit file located into
nano /proc/nginx_master_process_PID/limits

replace “nginxmasterprocess_ID” with process pid that you find in step 1

3- increase “Max open files” value

4- save and exit .

Have another answer? Share your knowledge.