Debian12安装nginx
12

安装

  1. 更新软件包索引
    打开终端并输入以下命令以确保你的包索引是最新的:

    apt update
    
  2. 安装 Nginx
    使用 apt 包管理器安装 Nginx:

    apt install nginx
    
  3. 启动 Nginx
    安装完成后,启动 Nginx 服务:

    systemctl start nginx
    
  4. 确保 Nginx 在系统启动时自动启动
    启动成功后,可以设置 Nginx 在系统启动时自动启动:

    systemctl enable nginx
    
  5. 验证 Nginx 是否正常运行
    你可以通过访问服务器的 IP 地址来验证 Nginx 是否正常运行。打开浏览器并输入服务器的 IP 地址,例如:

    curl http://ip
    

    如果看到 Nginx 欢迎页面,说明安装和启动成功。

  6. 配置文件目录 /etc/nginx

常用命令

  • 重启 Nginx

    systemctl restart nginx
    
  • 停止 Nginx

    systemctl stop nginx
    
  • 查看 Nginx 状态

    systemctl status nginx
    
Debian12安装nginx
http://152.53.84.24:8090/archives/debian12an-zhuang-nginx
作者
Administrator
发布于
更新于
许可