vi /home/nginx/conf/nginx.conflocation / { root /mnt; autoindex on; }
3.vmware 挂载 iso镜像文件
虚拟机->设置->CD/DVD 选择“使用iso镜像文件”,“浏览”选择ISO文件路径。
4.挂载 镜像文件到 /mnt 之下。
mount /dev/cdrom /mnt
5.修改 CentOS-Base.repo
cd /etc/yum.repo.d/#备份一下cp CentOS-Base.repo CentOS-Base.repo.bakvi CentOS-Base.repo[base]name=CentOS-Centos-Localbaseurl=http://192.168.252.10gpgcheck=0
6.清空本地软件包缓存信息,重新生成
yum clean allyum makecache
7.关闭防火墙,启动 nginx
service iptables stop/home/nginx/sbin/nginx
如果出现以下错误
[root@node2 ~]# /opt/nginx/sbin/nginxnginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)[root@node2 ~]# fuser -k 80/tcp80/tcp: 1209 1210[root@node2 ~]# /home/nginx/sbin/nginx