概述

本文介绍在Linux下部署Nginx的详细步骤,以供参考。

环境说明

OS Version:CentOS Linux release 8.1.1911 (此为发行版本)

Linux下查看系统版本命令
查看系统发行版本:cat /etc/redhat-release
查看系统内核版本:uname -a

准备内容

Linux文件命令行工具Xshell 4

下载地址
链接:https://pan.baidu.com/s/1yBHjFQeD5IxOlVHqm8i2qA
提取码:tc22

部署步骤(部分步骤可忽略)

  • 通过Xshell工具使用root用户登录到Linux系统(这里使用的是阿里云ECS)。Linux下部署Nginx
  • 下载nginx软件包 (sudo yum install -y nginx)
    Linux下部署Nginx
  • 设置自动启动Nginx (sudo systemctl enable nginx)
    Linux下部署Nginx
  • 启动Nginx (sudo systemctl start nginx)
    Linux下部署Nginx
  • 查看Nginx启动状态 (sudo systemctl status nginx)
    Linux下部署Nginx

常用位置

  • 静态页面:/usr/share/nginx/html
  • 配置文件:/etc/nginx/nginx.conf

常用命令

  • 查看Nginx:sudo systemctl status nginx
  • 停止Nginx:sudo systemctl stop nginx
  • 启动Nginx:sudo systemctl start nginx
  • 重启Nginx:sudo systemctl reload nginx

相关文章: