在Debian系统中,LNMP指的是Linux、Nginx、MySQL/MariaDB和PHP的组合。这些组件通常用于搭建动态网站和Web应用程序。以下是一些常用的LNMP服务管理命令:
启动Nginx
sudo systemctl start nginx
停止Nginx
sudo systemctl stop nginx
重启Nginx
sudo systemctl restart nginx
查看Nginx状态
sudo systemctl status nginx
设置Nginx开机自启
sudo systemctl enable nginx
取消Nginx开机自启
sudo systemctl disable nginx
启动MySQL/MariaDB
sudo systemctl start mysql
或者
sudo systemctl start mariadb
停止MySQL/MariaDB
sudo systemctl stop mysql
或者
sudo systemctl stop mariadb
重启MySQL/MariaDB
sudo systemctl restart mysql
或者
sudo systemctl restart mariadb
查看MySQL/MariaDB状态
sudo systemctl status mysql
或者
sudo systemctl status mariadb
设置MySQL/MariaDB开机自启
sudo systemctl enable mysql
或者
sudo systemctl enable mariadb
取消MySQL/MariaDB开机自启
sudo systemctl disable mysql
或者
sudo systemctl disable mariadb
PHP通常作为PHP-FPM(FastCGI Process Manager)运行,用于处理PHP脚本。
启动PHP-FPM
sudo systemctl start php-fpm
停止PHP-FPM
sudo systemctl stop php-fpm
重启PHP-FPM
sudo systemctl restart php-fpm
查看PHP-FPM状态
sudo systemctl status php-fpm
设置PHP-FPM开机自启
sudo systemctl enable php-fpm
取消PHP-FPM开机自启
sudo systemctl disable php-fpm
更新系统包
sudo apt update && sudo apt upgrade
安装Nginx
sudo apt install nginx
安装MySQL/MariaDB
sudo apt install mysql-server
或者
sudo apt install mariadb-server
安装PHP及其常用扩展
sudo apt install php-fpm php-mysql php-curl php-gd php-mbstring php-xml php-zip
检查PHP配置
php --ini
查看Nginx配置文件
sudo nano /etc/nginx/nginx.conf
查看PHP配置文件
sudo nano /etc/php/7.4/fpm/php.ini
(请根据实际安装的PHP版本调整路径)
通过这些命令,你可以方便地管理Debian系统中的LNMP服务。