个人环境:CenterOS 6.7 Ngnix1.10.2linux
1.解决依赖的问题nginx
// 执行命令以前,记得先将DNS设置为114.114.114.114/8.8.8.8,否则各类下载失败. // 若是你网络不通畅,可能会获得提示说你的pcre是最新的,我就出现过 yum install -y pcre pcre-devel yum install -y openssl openssl-devel //安装成功的最终提示符"Complete!"
我发现有博文说 gcc,openssl,zlib,pcre有这么多依赖,并且能够经过rpm -q来检测.可是到我这出问题了.我检测出来所有有,就是安装的时候不成功,卡在make那一步,估计是依赖的版本不支持nginx,若是你安装的也是新版的,建议先执行上面两行命名网络
2.下载nginx.net
wget http://nginx.org/download/nginx-1.10.2.tar.gz
3.解压 ,切换到解压缩后的目录rest
tar -zxvf nginx-1.10.2.tar.gz cd nginx-1.10.2
3.设置配置信息code
// 下面这一句直接复制就能够 // 注意/home/nginx-1.10.2这个是你解压缩的目录,否则就是各类失败了 ./configure --prefix=/home/nginx-1.10.2 --conf-path=/home/nginx-1.10.2/nginx.conf --with-http_stub_status_module --with-http_ssl_module // 完毕! //我在执行这个命令时会输出不少东西,须要的能够参考一下,(至少我在失败时,很快就执行完毕了,并且结果也不对) Configuration summary + using system PCRE library + using system OpenSSL library + md5: using OpenSSL library + sha1: using OpenSSL library + using system zlib library nginx path prefix: "/home/nginx-1.10.2" nginx binary file: "/home/nginx-1.10.2/sbin/nginx" nginx modules path: "/home/nginx-1.10.2/modules" nginx configuration prefix: "/home/nginx-1.10.2" nginx configuration file: "/home/nginx-1.10.2/nginx.conf" nginx pid file: "/home/nginx-1.10.2/logs/nginx.pid" nginx error log file: "/home/nginx-1.10.2/logs/error.log" nginx http access log file: "/home/nginx-1.10.2/logs/access.log" nginx http client request body temporary files: "client_body_temp" nginx http proxy temporary files: "proxy_temp" nginx http fastcgi temporary files: "fastcgi_temp" nginx http uwsgi temporary files: "uwsgi_temp" nginx http scgi temporary files: "scgi_temp"
4.make && make installhtm
若是前面配置出错,或者依赖出错的话,那么这一步就会痛不欲生.blog
5.验证nginxmd5
/home/nginx-1.10.2/sbin/nginx -v //若是成功会获得结果 nginx version: nginx/1.10.2
写的不详细,还请见谅ssl
参考:
http://www.linuxidc.com/Linux/2016-07/133463.htm