CentOS7 安装 Web 服务(Nginx)

  • 前提

# 进入服务器


  • 安装 Nginx

# 使用 yum 命令安装 Nginx

输入指令: yum install -y nginx

# 安装完成后, 启动 Nginx

输入指令: nginx

# 设置 Nginx 开机启动

systemctl enable nginx.service


  • 检验 nginx 是否安装成功

# 访问服务器的公 IP 地址来确认


# 访问出错, 未出现网页

# 添加安全组规则

# 找到安全组配置

# 添加安全组规则

# 入方向

设置端口范围 80/80

# 访问 HTTP 请求需要开放 80 端口

设置授权对象 0.0.0.0/0

# 代表公共, 任何人都可以访问

# 出方向同

# 刷新网页

# 出现 nginx 访问页


猜你喜欢

转载自blog.csdn.net/y_silence_/article/details/80276639