我们有一个带有Laravel和Node Socket.io的NGINX服务器 我不知道为什么,但是一段时间后变得越来越迟钝。
那是为什么? 多数民众赞成在套接字的NGINX设置
server {
server_name s.example.com;
listen 443 ssl;
ssl_certificate /etc/letsencrypt/live/s.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/s.example.com/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/s.example.com/fullchain.pem;
include /etc/nginx/snippets/ssl.conf;
client_max_body_size 20M;
location / {
proxy_pass http://127.0.0.1:2053;
proxy_http_version 1.1;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-NginX-Proxy true;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $http_host;
proxy_redirect off;
#proxy_buffering off;
#proxy_buffers 8 2m;
#proxy_buffer_size 10m;
#proxy_busy_buffers_size 10m;
#proxy_read_timeout 86400;
}
}
就是网站
server {
server_name www.example.com;
listen 443 ssl;
ssl_certificate /etc/letsencrypt/live/www.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/www.example.com/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/www.example.com/fullchain.pem;
include /etc/nginx/snippets/ssl.conf;
root /var/www/example.com/site/public;
index index.php index.html index.htm;
try_files $uri $uri/ /index.php$is_args$args;
large_client_header_buffers 8 32k;
location ~ /.well-known {
allow all;
}
location ~ \.php$ {
#try_files $uri = 404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
我不知道,为什么网站一段时间后会滞后。
用户的使用过程也越来越高。 当我打开网站时,CPU,RAM和GPU上升了10%左右
htop
上的“我的服务器”显示所有内容的0%,那是什么都没有。内核只有很少的峰值达到5-10%的时间,仅此而已。