個人環境: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