温馨提示×

debian lnmp怎么启动

小樊
35
2026-09-16 23:45:21
栏目: 智能运维

在 Debian 上启动 LNMP(Linux + Nginx + MySQL/MariaDB + PHP),一般按下面步骤来。假设你是用 apt 安装的标准 LNMP 环境。


一、启动 Nginx

sudo systemctl start nginx

设置开机自启:

sudo systemctl enable nginx

查看状态:

sudo systemctl status nginx

二、启动 MySQL / MariaDB

Debian 默认可能是 MariaDB:

sudo systemctl start mariadb

或

sudo systemctl start mysql

开机自启:

sudo systemctl enable mariadb

查看状态:

sudo systemctl status mariadb

三、启动 PHP-FPM

PHP 一般通过 php-fpm 运行(如 PHP 8.2):

sudo systemctl start php8.2-fpm

开机自启:

sudo systemctl enable php8.2-fpm

查看状态:

sudo systemctl status php8.2-fpm

如果你不确定 PHP 版本,可用:

php -v

四、一键启动(常用)

sudo systemctl start nginx mariadb php8.2-fpm

五、检查 LNMP 是否正常工作

  1. 浏览器访问服务器 IP
    http://你的服务器IP
    
  2. 查看 Nginx 是否返回页面
  3. 测试 PHP:
sudo nano /var/www/html/info.php

写入:

<?php phpinfo(); ?>

访问:

http://你的服务器IP/info.php

六、如果 LNMP 是用一键包装的(如 lnmp.org)

lnmp start

如果你能告诉我:

  • 是 apt 安装 还是 一键包
  • Debian 版本
  • 是否报错

我可以给你更精确的命令。

0 踩