在 Ubuntu 上,LNMP 一般指 Linux + Nginx + MySQL(MariaDB) + PHP。重启服务的方式取决于你是用 apt 安装 还是 LNMP 一键包。
sudo systemctl restart nginx
查看状态:
sudo systemctl status nginx
如果是 MySQL:
sudo systemctl restart mysql
如果是 MariaDB:
sudo systemctl restart mariadb
先确认 PHP 版本,例如 PHP 8.1:
sudo systemctl restart php8.1-fpm
查看已安装版本:
ls /etc/php/
sudo systemctl restart nginx
sudo systemctl restart mysql
sudo systemctl restart php8.1-fpm
如果你是用官方的 LNMP 一键包:
lnmp restart
或单独重启:
lnmp nginx restart
lnmp mysql restart
lnmp php-fpm restart
先看错误:
sudo nginx -t
确认网站用的是哪个 PHP 版本:
ps aux | grep php-fpm
如果你能告诉我:
我可以给你更精确的重启命令。