1. 程式人生 > >在CentOS 7.2上編譯安裝Nginx 1.13.6

在CentOS 7.2上編譯安裝Nginx 1.13.6

創建 ont uname group with pen 還需 www stub

第一個裏程碑 --- 檢查軟件安裝的系統環境

[root@rainjin ~]# cat /etc/redhat-release

CentOS Linux release 7.2.1511 (Core)

[root@rainjin ~]# uname -r

3.10.0-327.el7.x86_64

第二個裏程碑 --- 下載源碼包

技術分享

說明: 這些是從官網下載的源碼包,通過rz命令上傳至統一目錄 ”/home/rainjin/tools“;

第三個裏程碑 --- 解壓這些源碼包

[root@rainjin tools]# tar xf nginx-1.13.6.tar.gz

[root@rainjin tools]# tar xf openssl-1.1.0f.tar.gz

[root@rainjin tools]# tar xf pcre-8.41.tar.gz

[root@rainjin tools]# tar xf zlib-1.2.11.tar.gz

第四個裏程碑 --- 進入nginx目錄

技術分享

第五個裏程碑 --- 創建www用戶

[root@rainjin nginx-1.13.6]# useradd -s /sbin/nologin -M www

第六個裏程碑 --- 編譯安裝

[root@rainjin nginx-1.13.6]# ./configure --help

[root@rainjin nginx-1.13.6]# ./configure --prefix=/application/nginx-1.13.6 --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-pcre=../pcre-8.41 --with-zlib=../zlib-1.2.11 --with-openssl=../openssl-1.1.0f

[root@rainjin nginx-1.13.6]# make &&make install

第七個裏程碑 --- 創建軟連接

技術分享

第七個裏程碑 --- 啟動nginx

[root@rainjin ~]# ps -ef | grep nginx
root 39862 1 0 19:28 ? 00:00:00 nginx: master process /application/nginx/sbin/nginx
www 39863 39862 0 19:28 ? 00:00:00 nginx: worker process
root 39871 38190 0 19:28 pts/4 00:00:00 grep --color=auto nginx

說明: 查看進程

[root@rainjin ~]# netstat -lntup | grep 80
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 39862/nginx: master

說明: 查看端口

第七個裏程碑 --- 在瀏覽器端訪問

技術分享

第八個裏程碑 --- 查看安裝過程

[root@rainjin nginx]# /application/nginx/sbin/nginx -V

nginx version: nginx/1.13.6

built by gcc 4.8.5 20150623 (Red Hat 4.8.5-4) (GCC)

built with OpenSSL 1.1.0f 25 May 2017

TLS SNI support enabled

configure arguments: --prefix=/application/nginx-1.13.6 --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-pcre=../pcre-8.41 --with-zlib=../zlib-1.2.11 --with-openssl=../openssl-1.1.0f

說明: 此安裝過程,均采用最新版源碼包,僅作為測試使用,生產環境應選擇合適穩定的版本!!!由於作者水平有限,時間倉促,還需完善...;

2017年10月28日19:37:20

在CentOS 7.2上編譯安裝Nginx 1.13.6