0、(第1步,第2步可以跳过;如果yum -y install nginx 出现找不到包,执行第2步)
1、阿里云更换:(文章地址:点击打开链接)
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
2、yum 安装 Nginx 没有库(文章地址:点击打开链接)
20180420号前epel地址,404就找里面的地址;
下载epel,然后在安装
a、wget http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-11.noarch.rpm
b、rpm -ivh epel-release-7-11.noarch.rpm
3、安装Nginx
yum -y install nginx
4、查看安装情况
a、Nginx 安装包:rpm -qa | grep nginx
b、Nginx 安装位置:rpm -ql nginx
5、启动/停止/开机自动启动(文章地址:点击打开链接)
systemctl start nginx.service
systemctl stop nginx.service
systemctl enable nginx.service
6、访问
默认端口80
7、配置文件
Nginx 主配置文件位置:/etc/nginx/nginx.conf
8、稍微改一下端口试一下配置文件(将80接口改成8080)
9、重启Nginx
10、访问 ip:8080