1. Installation instructions
prior to first install nginx on a new computer, you need to set nginx package repository. After that, you can nginx install and update from the repository.
[root@localhost ~]# sudo yum -y install yum-utils #先决条件
Configuring nginx source of Yum
[root@localhost ~]# vim /etc/yum.repos.d/nginx.repo
添加如下几行代码
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1
3.yum installation
[root@localhost ~]# yum -y install nginx
This installation was successful. It is not very fast?
The second step of the code which can be found at the official website, follow these steps:
Configure official website Yum sources
4. If you want to show the nginx web page, you need to
[root@localhost ~]# setenforce 0 #关闭selinux
[root@localhost ~]# systemctl stop firewalld #关闭防火墙
[root@localhost ~]# systemctl start nginx #启动nginx