1.安装工具包(默认已存在这些功能)
1 yum install -y wget 2 yum install -y vim-enhanced 3 yum install -y make cmake gcc gcc-c++
2.安装依赖包(pcre可能直接无法安装,从官网上下载编译安装即可;)
yum install -y pcre pcre-devel yum install -y zlib zlib-devel yum install -y openssl openssl-devel
3.下载nginx安装包
wget http://nginx.org/download/nginx-1.6.2.tar.gz
4.解压到指定目录
tar -zxvf nginx-1.6.2.tar.gz -C /usr/local/
5.进行configure配置,进入nginx-1.6.2目录然后在执行./configure命令,成功后编译安装
./configure --prefix=/usr/local/nginx make && make install
6.启动服务,检查是否已正常启动
/usr/local/nginx/sbin/nginx ps -ef | grep nginx
7.关闭、重启服务
/usr/local/nginx/sbin/nginx -s stop
/usr/local/nginx/sbin/nginx -s reload