[root@localhost ~]# yum -y install gcc zlib zlib-devel pcre-devel openssl openssl-devel
下载依赖包
[root@localhost ~]# cd /usr/local/
[root@localhost local]# ls
bin etc games include lib lib64 libexec sbin share src
[root@localhost local]# mkdir nginx
[root@localhost local]# cd nginx/
[root@localhost nginx]#
[root@localhost nginx]# wget http://nginx.org/download/nginx-1.13.7.tar.gz
下载nginx安装包
[root@localhost nginx]# tar -xvf nginx-1.13.7.tar.gz
解压安装包
[root@localhost nginx]# ls
nginx-1.13.7 nginx-1.13.7.tar.gz
[root@localhost nginx]# mv nginx-1.13.7 nginx
更改名称
[root@localhost nginx]# ls
nginx nginx-1.13.7.tar.gz
[root@localhost nginx]# cd nginx
[root@localhost nginx]# ls
[root@localhost nginx]# ./configure
配置
[root@localhost nginx]# mkae
编译
[root@localhost nginx]# make install
安装
[root@localhost sbin]# /usr/local/nginx/sbin/nginx
启动
[root@localhost sbin]# ps -ef | grep nginx
root 5226 1 0 23:01 ? 00:00:00 nginx: master process /usr/local/nginx/sbin/nginx
nobody 5227 5226 0 23:01 ? 00:00:00 nginx: worker process
root 5229 2616 0 23:01 pts/0 00:00:00 grep nginx
如果本地访问不了虚拟机的nginx链接
[root@localhost lost+found]# /sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT
[root@localhost lost+found]# /etc/init.d/iptables save
iptables:将防火墙规则保存到 /etc/sysconfig/iptables: [确定]
[root@localhost lost+found]# /etc/init.d/iptables restart
iptables:将链设置为政策 ACCEPT:filter [确定]
iptables:清除防火墙规则: [确定]
iptables:正在卸载模块: [确定]
iptables:应用防火墙规则: [确定]
在本地 输入drivers /etc目录 hosts文件 后缀加10.0.0.100 www.lizhiwei.org
/usr/local/nginx/conf 在nginx.conf 配置端口
/usr/local/nginx/html 配置页面