1、添加CentOS 7 Nginx yum资源库,打开终端,使用以下命令:
sudo rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
2、安装nginx
sudo yum install -y nginx
3、启动nginx
sudo systemctl start nginx.service
开机自动启动:sudo systemctl enable nginx.service