Wie kann ich auf dem Webserver "zu viele offene Dateien" -Fehler beheben? [geschlossen]Linux

Linux verstehen
Anonymous
 Wie kann ich auf dem Webserver "zu viele offene Dateien" -Fehler beheben? [geschlossen]

Post by Anonymous »

Ich hatte einen Server, der auf Apache basierte. Es wurde verwendet, um mehrere Bildfliesen einer Karte zu servieren. Ich dachte daran, es zu verbessern, indem ich es auf http3 verlagert habe, denn dies musste mich auf Nginx und schnelles Protokoll wechseln. Seit der Verschiebung eines seltsamen Problems nach einiger Zeit müssen der Netzwerkantwortcode für Bilder zu 500 und Nginx neu gestartet werden, um ein anderes Bild weiterzuladen. Bei weiterer Untersuchung der Fehlerprotokolle von Nginx erhalte ich "zu viele geöffnete Dateien". Um die folgenden Änderungen vorzunehmen: < /p>
  • Erhöhen Sie "Worker_Rlimit_Nofile" < /li>
    entfernt "open_file_cache" < /li>
    < /ol>
    Während der 2. Modifikation hat eine Verbesserung des Problems keine Verbesserung beigebracht. Ich kann dieses Problem nicht debuggen oder lösen. Einige Beobachtungen, die ich hatte: < /p>

    Während Apache 13 Arbeiter nginx hatte, hatte 92 Arbeiter (mit PS -Aux < /code> Bash -Befehl erhalten) < /li>
    systemweites maximaleres Dateien -Grenze ist 922337203685777777777778807 (erhalten mit Katzen erhalten (mit Katzen) (mit Katzen erhalten /proc/sys/fs/file-max )
Konfiguration für Apache war:

Code: Select all

DefaultRuntimeDir ${APACHE_RUN_DIR}
PidFile ${APACHE_PID_FILE}
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}
HostnameLookups Off
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf
Include ports.conf

Options FollowSymLinks
AllowOverride None
Require all denied


AllowOverride None
Require all granted


Options Indexes FollowSymLinks
AllowOverride None
Require all granted

AccessFileName .htaccess

Require all denied

LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
IncludeOptional conf-enabled/*.conf
IncludeOptional sites-enabled/*.conf
< /code>
und die Konfiguration für Nginx lautet: < /p>
worker_processes auto;
worker_rlimit_nofile 100000;
error_log  logs/error.log;
events {
worker_connections  32768;
multi_accept on;
}
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  logs/access.log  main;
sendfile        on;
keepalive_timeout  65;
http3_stream_buffer_size 2m;
quic_gso on;
http3_max_concurrent_streams 512;
tcp_nodelay on;
tcp_nopush on;
server {
listen       80;
server_name  catmap.ptmil.cd.in;
location / {
root   html;
index  index.php index.html index.htm;
}
error_page   500 502 503 504  /50x.html;
location = /50x.html {
root   html;
}
}
server {
server_name map.ptmil.cd.in;
ssl_certificate     /etc/nginx/ssl/ptmil.cd.in/PTMIL.crt;
ssl_certificate_key /etc/nginx/ssl/ptmil.cd.in/PTMIL.key;
quic_retry on;
ssl_early_data on;

ssl_prefer_server_ciphers off;
ssl_session_timeout 1d;
ssl_session_cache shared:MozSSL:64m;
root /var/www/html/map;
index index.php;

client_max_body_size 2048m;
gzip_static on;
location / {
try_files $uri $uri/ =404;
}
location ~ /\.ht {
deny all;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;
fastcgi_param PHP_VALUE "upload_max_filesize=2048M \n post_max_size=2048M";
}
location = /favicon.ico {
access_log off;
log_not_found off;
}

location /newsat {
expires 2d;
add_header Cache-Control "public";
}
location ~* \.(js|css)$ {
expires 10h;
add_header Cache-Control "public";
}
location ~* \.(jpg|jpeg|png|gif)$ {
expires 7d;
add_header Cache-Control "public";
}
location ~ \.gz$ {
deny all;
}
add_header Alt-Svc 'h3=":443"; ma=86400, h3-29=":443"; ma=86400' always;
add_header Alt-Svc  'h2=":443"; ma=2592000;  persist=1';
add_header Alt-Svc  'h2=":443"; ma=2592000;';
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";
}
}
< /code>
systemd -Datei für Apache: < /p>
[Unit]
Description=The Apache HTTP Server
After=network.target remote-fs.target nss-lookup.target
Documentation=https://httpd.apache.org/docs/2.4/

[Service]
Type=forking
Environment=APACHE_STARTED_BY_SYSTEMD=true
ExecStart=/usr/sbin/apachectl start
ExecStop=/usr/sbin/apachectl graceful-stop
ExecReload=/usr/sbin/apachectl graceful
KillMode=mixed
PrivateTmp=true
Restart=on-abort

[Install]
WantedBy=multi-user.target

< /code>
systemd -Datei für nginx: < /p>
[Unit]
Description=The NGINX HTTP and reverse proxy server
After=network.target

[Service]
LimitNOFILE=100000
Type=forking
PIDFile=/usr/local/nginx/logs/nginx.pid
ExecStartPre=/usr/local/nginx/sbin/nginx -t
ExecStart=/usr/local/nginx/sbin/nginx
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true

[Install]
WantedBy=multi-user.target
Ausgabe von Ulimit -a Befehl ist:
real-time non-blocking time (microseconds, -R) unlimited
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 880215
max locked memory (kbytes, -l) 28181404
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 880215
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited

< /code>
Der Host basiert Ubuntu 20. Ich habe meinen Kopf darin verblüfft, kann aber nicht viel tun. Welchen nächsten Schritt sollte ich unternehmen? Vielen Dank im Voraus.

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post