1、准备yum源
vi /etc/yum.repo.d/nginx.repo
[nginx] name=nginx repo baseurl=http://nginx.org/packages/mainline/rhel/7/$basearch/ gpgcheck=0 enable=1
准备好了源之后,更新源
$ yum clean all $ yum makecache
2、安装nginx
$ yum install -y nginx
安装成功之后可以通过 $ nginx -v查看版本
[root@docker php-5.5.38]# nginx -v nginx version: nginx/1.13.0
3、启动nginx并通过浏览器查看页面
$ nginx $ systemctl stop firewalld //关闭防火墙 $ systemctl disable firewalld //禁止开机启动
访问地址:http://192.168.61.150