CentOS 7安装nginx

  |   Linux Nginx

在linux系统中没有默认nginx的rpm包,所以我们需要自己更新nginx的rpm包,还有如何安装nginx服务器。

1.添加nginx到yum源

[root@localhost /]# rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

2.安装Nginx

[root@localhost /]# yum install -y nginx

3.启动Nginx

[root@localhost /]# systemctl start nginx.service

注意的是CentOS 7 开机启动Nginx

[root@localhost /]# systemctl enable nginx.service