阿里云CentOs7-服务器安装nginx

首先安装nginx

安装epel-release源并进行安装

yum install epel-release
yum update
yum install nginx

运行完成大致有这三样的输出结果

防火墙相关操作

systemctl start nginx #启动
systemctl stop nginx #停止
systemctl restart nginx #重启
systemctl status nginx #查看运行状态
systemctl enable nginx #开机启动

设置防火墙

firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-service=https
firewall-cmd --reload

nginx启动和关闭

pkill -f nginx  #关闭
nginx    #启动

安装完成之后就可输入自己IP 看到nginx的访问页面

用命令查看

来确认首先nginx已经启动

其中你可能会访问不了自己的ip,阿里云服务器的安全组

这样的即可完成

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理