在Ubuntu上管理LNMP服务,可使用以下命令:
sudo systemctl start nginx(启动)、sudo systemctl stop nginx(停止)、sudo systemctl restart nginx(重启)、sudo systemctl reload nginx(重新加载配置)、sudo systemctl enable nginx(设置开机自启)、sudo systemctl disable nginx(禁止开机自启)。sudo systemctl start mysql(启动)、sudo systemctl stop mysql(停止)、sudo systemctl restart mysql(重启)、sudo mysql_secure_installation(安全配置)。sudo systemctl start php-fpm(启动)、sudo systemctl stop php-fpm(停止)、sudo systemctl restart php-fpm(重启)、sudo systemctl reload php-fpm(重新加载配置)。此外,还可通过查看日志文件来排查服务问题,Nginx日志位于/var/log/nginx/error.log,MySQL日志位于/var/log/mysql/error.log,PHP-FPM日志位于/var/log/php-fpm/error.log。