在Ubuntu上监控LNMP运行状态,可通过以下方式:
sysstat
)。sudo systemctl status nginx
或访问http://服务器IP/nginx_status
(需启用ngx_http_stub_status_module
)。sudo systemctl status mysql
或 sudo mysqladmin status
。sudo systemctl status php-fpm
。sudo tail -n 10 /var/log/nginx/error.log
查看错误日志。sudo tail -n 10 /var/log/mysql/error.log
分析慢查询等日志。根据需求选择工具,生产环境建议使用Zabbix、Prometheus+Grafana等专业方案实现全面监控和告警。