在 Ubuntu 上“重启 LAMP”通常指重启 Apache + MySQL/MariaDB + PHP(PHP 一般不需要单独重启)。下面按常见情况说明。
sudo systemctl restart apache2
查看状态:
sudo systemctl status apache2
sudo systemctl restart mysql
sudo systemctl restart mariadb
查看状态:
sudo systemctl status mysql
# 或
sudo systemctl status mariadb
sudo systemctl restart apache2
sudo systemctl restart mysql
(或 mariadb)
sudo systemctl enable apache2
sudo systemctl enable mysql
如果 systemctl 不可用:
sudo service apache2 restart
sudo service mysql restart
sudo netstat -tulnp | grep -E '80|3306'
或
curl http://localhost
如果你是想 重启整个服务器,也可以用:
sudo reboot
如果你用的是 特定 Ubuntu 版本 或 LNMP(Nginx),可以告诉我,我给你对应命令。