目录
linux安装nginx
1.添加源
sudo rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
2.更新源
$ sudo sed -i -e "s|mirrorlist=|#mirrorlist=|g" /etc/yum.repos.d/CentOS-*
$ sudo sed -i -e "s|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g" /etc/yum.repos.d/CentOS-* sudo dnf install -y curl policycoreutils openssh-server perl
3.安装nginx
sudo yum install -y nginx
4.启动nginx
sudo systemctl start nginx.service
5.测试是否成功
启动后在浏览器上访问,网页出现一下说明安装成功
http://192.168.139.135 这里是你虚拟机的ip 用ifconfig查看