温馨提示×

Ubuntu如何管理LNMP服务

小樊
49
2025-09-14 13:17:33
栏目: 智能运维

在Ubuntu上管理LNMP服务,可使用以下命令:

  • Nginxsudo systemctl start nginx(启动)、sudo systemctl stop nginx(停止)、sudo systemctl restart nginx(重启)、sudo systemctl reload nginx(重新加载配置)、sudo systemctl enable nginx(设置开机自启)、sudo systemctl disable nginx(禁止开机自启)。
  • MySQLsudo systemctl start mysql(启动)、sudo systemctl stop mysql(停止)、sudo systemctl restart mysql(重启)、sudo mysql_secure_installation(安全配置)。
  • PHP-FPMsudo 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

0