VPS侦探论坛

 找回密码
 注册
查看: 2107|回复: 3

LNMP 会出现 502,重启 php-frm 可以解决,但是过两三天又会...

[复制链接]
发表于 2022-12-2 10:54:34 | 显示全部楼层 |阅读模式


这几年一直使用 LNMP,都挺稳定,但是最近网站会频繁出现 502 的错误,主要是体现在 PHP 这边,现在贴出日志和配置,LNMP1.9,请军哥帮忙看下
  1. mysql --version
  2. mysql  Ver 14.14 Distrib 5.7.38, for linux-glibc2.12 (x86_64) using  EditLine wrapper

  3. php --version
  4. PHP 8.1.7 (cli) (built: Sep 16 2022 10:07:17) (NTS)
  5. Copyright (c) The PHP Group
  6. Zend Engine v4.1.7, Copyright (c) Zend Technologies

  7. nginx -v
  8. nginx version: nginx/1.22.0
复制代码



vim /usr/local/php/var/log/php-fpm.log
  1. [02-Dec-2022 02:15:00] WARNING: [pool www] child 929400 exited on signal 11 (SIGSEGV - core dumped) after 3832.662718 seconds from start
  2. [02-Dec-2022 02:15:00] NOTICE: [pool www] child 939308 started
  3. [02-Dec-2022 02:15:00] WARNING: [pool www] child 929411 exited on signal 11 (SIGSEGV - core dumped) after 3832.680680 seconds from start
  4. [02-Dec-2022 02:15:00] NOTICE: [pool www] child 939309 started
  5. [02-Dec-2022 02:15:00] WARNING: [pool www] child 929402 exited on signal 11 (SIGSEGV - core dumped) after 3832.706473 seconds from start
  6. [02-Dec-2022 02:15:00] NOTICE: [pool www] child 939310 started
  7. [02-Dec-2022 02:15:00] WARNING: [pool www] child 929403 exited on signal 11 (SIGSEGV - core dumped) after 3832.729209 seconds from start
  8. [02-Dec-2022 02:15:00] NOTICE: [pool www] child 939311 started
  9. [02-Dec-2022 02:15:00] WARNING: [pool www] child 929407 exited on signal 11 (SIGSEGV - core dumped) after 3832.749185 seconds from start
  10. [02-Dec-2022 02:15:00] NOTICE: [pool www] child 939314 started
  11. [02-Dec-2022 02:15:00] WARNING: [pool www] child 929406 exited on signal 11 (SIGSEGV - core dumped) after 3832.771680 seconds from start
  12. [02-Dec-2022 02:15:00] NOTICE: [pool www] child 939319 started
  13. [02-Dec-2022 02:15:00] WARNING: [pool www] child 929405 exited on signal 11 (SIGSEGV - core dumped) after 3832.794327 seconds from start
  14. [02-Dec-2022 02:15:00] NOTICE: [pool www] child 939320 started
  15. [02-Dec-2022 02:15:00] WARNING: [pool www] child 929401 exited on signal 11 (SIGSEGV - core dumped) after 3832.818900 seconds from start
  16. [02-Dec-2022 02:15:00] NOTICE: [pool www] child 939321 started
  17. [02-Dec-2022 02:15:00] WARNING: [pool www] child 929410 exited on signal 11 (SIGSEGV - core dumped) after 3832.836387 seconds from start
  18. [02-Dec-2022 02:15:00] NOTICE: [pool www] child 939322 started
  19. [02-Dec-2022 02:15:00] WARNING: [pool www] child 929404 exited on signal 11 (SIGSEGV - core dumped) after 3832.860955 seconds from start
  20. [02-Dec-2022 02:15:00] NOTICE: [pool www] child 939323 started
  21. [02-Dec-2022 02:15:01] WARNING: [pool www] child 929418 exited on signal 11 (SIGSEGV) after 3834.385191 seconds from start
  22. [02-Dec-2022 02:15:01] NOTICE: [pool www] child 939339 started
复制代码


vim /home/wwwlogs/nginx_error.log
  1. 2022/12/01 13:16:43 [crit] 796753#0: *1558 SSL_do_handshake() failed (SSL: error:141CF06C:SSL routines:tls_parse_ctos_key_share:bad key share) while SSL handshaking, client: 45.40.57.56, server: 0.0.0.0:443
  2. 2022/12/01 17:46:54 [crit] 822434#0: *4104 SSL_do_handshake() failed (SSL: error:141CF06C:SSL routines:tls_parse_ctos_key_share:bad key share) while SSL handshaking, client: 94.102.61.8, server: 0.0.0.0:443
  3. 2022/12/01 18:00:24 [crit] 822429#0: *4202 SSL_do_handshake() failed (SSL: error:141CF06C:SSL routines:tls_parse_ctos_key_share:bad key share) while SSL handshaking, client: 94.102.61.8, server: 0.0.0.0:443
  4. 2022/12/01 21:32:34 [crit] 822433#0: *5220 SSL_do_handshake() failed (SSL: error:141CF06C:SSL routines:tls_parse_ctos_key_share:bad key share) while SSL handshaking, client: 192.241.212.132, server: 0.0.0.0:443
  5. 2022/12/01 22:21:21 [crit] 822427#0: *5288 SSL_do_handshake() failed (SSL: error:141CF06C:SSL routines:tls_parse_ctos_key_share:bad key share) while SSL handshaking, client: 212.102.40.218, server: 0.0.0.0:443
  6. 2022/12/02 05:23:27 [crit] 928815#0: *121 SSL_do_handshake() failed (SSL: error:141CF06C:SSL routines:tls_parse_ctos_key_share:bad key share) while SSL handshaking, client: 106.75.226.239, server: 0.0.0.0:443
  7. 2022/12/02 06:09:35 [crit] 928819#0: *152 SSL_do_handshake() failed (SSL: error:141CF06C:SSL routines:tls_parse_ctos_key_share:bad key share) while SSL handshaking, client: 103.213.96.233, server: 0.0.0.0:443
复制代码


vim /usr/local/nginx/conf/vhost/domain.com.conf
  1. server
  2.     {
  3.         listen 80;
  4.         #listen [::]:80;
  5.         server_name domain.com;
  6.         index index.html index.htm index.php default.html default.htm default.php;
  7.         root  /home/wwwroot/domain.com;

  8.         #include rewrite/none.conf;
  9.         #error_page   404   /404.html;

  10.         # Deny access to PHP files in specific directory
  11.         #location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }

  12.         # include enable-php.conf;

  13.         location ~ /.well-known {
  14.             allow all;
  15.         }

  16.         location ~ /\.
  17.         {
  18.             deny all;
  19.         }

  20.         location / {
  21.             return 301 https://$host$request_uri;
  22.         }

  23.         access_log off;
  24.     }

  25. server
  26.     {
  27.         listen 443 ssl http2;
  28.         #listen [::]:443 ssl http2;
  29.         server_name domain.com;
  30.         index index.html index.htm index.php default.html default.htm default.php;
  31.         root  /home/wwwroot/domain.com;

  32.         ssl_certificate ssl/domain.com/ssl.crt;
  33.         ssl_certificate_key ssl/domain.com/ssl.key;
  34.         ssl_session_timeout 5m;
  35.         ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
  36.         ssl_prefer_server_ciphers on;
  37.         ssl_ciphers "TLS13-AES-256-GCM-SHA384:TLS13-CHACHA20-POLY1305-SHA256:TLS13-AES-128-GCM-SHA256:TLS13-AES-128-CCM-8-SHA256:TLS13-AES-128-CCM-SHA256:EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5";
  38.         ssl_session_cache builtin:1000 shared:SSL:10m;
  39.         # openssl dhparam -out /usr/local/nginx/conf/ssl/dhparam.pem 2048
  40.         ssl_dhparam /usr/local/nginx/conf/ssl/dhparam.pem;

  41.         # include rewrite/none.conf;
  42.         #error_page   404   /404.html;

  43.         # Deny access to PHP files in specific directory
  44.         #location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }

  45.         # include enable-php.conf;

  46.         location ~ /.well-known {
  47.             allow all;
  48.         }

  49.         location ~ /\.
  50.         {
  51.             deny all;
  52.         }

  53.         location /
  54.         {
  55.             try_files $uri $uri/ /index.html;
  56.         }

  57.         location /api/
  58.         {
  59.             proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  60.             proxy_ssl_server_name on;
  61.             proxy_pass https://api.domain.com/;
  62.         }

  63.         location ~ .*\.html$
  64.         {
  65.             add_header Cache-Control no-store;
  66.             add_header Pragma no-cache;
  67.             add_header Expires -1;
  68.         }

  69.         include vhost/app/*.conf;

  70.         access_log off;
  71.     }
复制代码


vim /usr/local/nginx/conf/vhost/api.domain.com.conf
  1. server
  2.     {
  3.         listen 443 ssl http2;
  4.         #listen [::]:443 ssl http2;
  5.         server_name api.domain.com;
  6.         index index.html index.htm index.php default.html default.htm default.php;
  7.         root  /home/wwwroot/api.domain.com/public;

  8.         ssl_certificate ssl/api.domain.com/ssl.crt;
  9.         ssl_certificate_key ssl/api.domain.com/ssl.key;
  10.         ssl_session_timeout 5m;
  11.         ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
  12.         ssl_prefer_server_ciphers on;
  13.         ssl_ciphers "TLS13-AES-256-GCM-SHA384:TLS13-CHACHA20-POLY1305-SHA256:TLS13-AES-128-GCM-SHA256:TLS13-AES-128-CCM-8-SHA256:TLS13-AES-128-CCM-SHA256:EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5";
  14.         ssl_session_cache builtin:1000 shared:SSL:10m;
  15.         # openssl dhparam -out /usr/local/nginx/conf/ssl/dhparam.pem 2048
  16.         ssl_dhparam /usr/local/nginx/conf/ssl/dhparam.pem;

  17.         include rewrite/laravel.conf;
  18.         #error_page   404   /404.html;

  19.         # Deny access to PHP files in specific directory
  20.         #location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }

  21.         include enable-php.conf;

  22.         location ~ /.well-known {
  23.             allow all;
  24.         }

  25.         location ~ /\.
  26.         {
  27.             deny all;
  28.         }

  29.         access_log off;
  30.     }
复制代码



---
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2022-12-2 16:43:22 | 显示全部楼层


502大概率和网站程序有关,开php慢日志一般就能看到程序那边的问题
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2022-12-5 09:29:37 | 显示全部楼层

licess 发表于 2022-12-2 16:43
502大概率和网站程序有关,开php慢日志一般就能看到程序那边的问题

好的军哥
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2022-12-7 10:51:57 | 显示全部楼层



licess 发表于 2022-12-2 16:43
502大概率和网站程序有关,开php慢日志一般就能看到程序那边的问题

第一次听说还有慢日志  学习了
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|VPS侦探 ( 鲁ICP备16040043号-1 )

GMT+8, 2024-11-23 22:00 , Processed in 0.026653 second(s), 17 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表