一.安装nginx
1.获取安装包(从官网www.nginx.com下载 )nginx-1.10.3.tar.gz
2.tar zxf nginx -1.10.3.tar.gz #解压打开包装
3.cd niginx-1.10.3/
4.cd auto/cc
vim gcc #注释掉其中的debug这一行 可以使得文件变小
5.cd nginx-1.10.3/ #进入到目录内才可以编译
####首先要解决依赖性问题
yum install gcc -y
yum install openssl-devel -y
yum install pcre-devel -y
./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-http_stub_status_module
#--prefix=指定安装的路径
#--with-http_ssl_module :表示支持https(ssl)
#--with-http_stub_status_module :查看nginx的工作状态
make
make install
/usr/local/nginx/sbin/nginx -t #检查主配置文件有无错误
/usr/local/nginx/sbin/nginx #启动nginx(启动nginx之前要先关闭httpd,因为都是占用80端口,会有冲突)
测试:在浏览器中输入本机ip,便会出现以下界面
