在CentOS 6.8 x86_64上安装nginx 1.10.3
生活随笔
收集整理的這篇文章主要介紹了
在CentOS 6.8 x86_64上安装nginx 1.10.3
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
本文檔記錄了完全使用最新源碼來編譯安裝nginx最新版1.10.3,所有的依賴也是最新的,便于第三方nginx模塊開發
假定使用root身份安裝
目前最新的源碼地址匯總
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.40.tar.gz
http://www.zlib.net/zlib-1.2.11.tar.gz
https://www.openssl.org/source/openssl-1.1.0e.tar.gz
http://nginx.org/download/nginx-1.10.3.tar.gz
安裝相關依賴
yum -y install gcc gcc-c++ automake autoconf libtool make glibc glibc-devel lsof
選擇源碼存放目錄
可以是任何目錄,本文選定的是/usr/local/src
cd /usr/local/src
在官網ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/下載最新的PCRE源碼包,使用下面命令下載編譯和安裝PCRE包:
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.40.tar.gz?
tar -zxvf pcre-8.40.tar.gz
cd pcre-8.40
./configure
make
make install
安裝zlib庫
在官網http://www.zlib.net/下載最新的zlib源碼包,使用下面命令下載編譯和安裝zlib包:
cd /usr/local/src
?
wget http://zlib.net/zlib-1.2.11.tar.gz
tar -zxvf zlib-1.2.11.tar.gz
cd zlib-1.2.11
./configure
make
make install
安裝openssl庫
在官網https://www.openssl.org/source/下載最新openssl源碼,使用下面的命令下載編譯和安裝openssl包:
cd /usr/local/src
wget https://www.openssl.org/source/openssl-1.1.0e.tar.gz
wget http://nginx.org/download/nginx-1.10.3.tar.gz
tar -zxvf nginx-1.10.3.tar.gz
cd nginx-1.10.3
?
./configure --with-http_ssl_module \
--with-pcre=/usr/local/src/pcre-8.40 \
--with-zlib=/usr/local/src/zlib-1.2.11 \
--with-openssl=/usr/local/src/openssl-1.1.0e
?
nginx相關操作
啟動nginx
cd /usr/local/nginx/sbin/
./nginx
快速停止:
cd /usr/local/nginx/sbin
./nginx -s stop
此方式相當于先查出nginx進程id再使用kill命令強制殺掉進程。
優雅停止
./nginx -s quit
此方式停止步驟是待nginx進程處理任務完畢進行停止。
重啟nginx
./nginx -s quit
./nginx
測試
nginx安裝成功,啟動nginx,即可訪問虛擬機上的nginx:
ps auxf | grep nginx
到這說明nginx上安裝成功。
參考文獻
[1].http://www.nginx.cn/install
[2].
假定使用root身份安裝
目前最新的源碼地址匯總
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.40.tar.gz
http://www.zlib.net/zlib-1.2.11.tar.gz
https://www.openssl.org/source/openssl-1.1.0e.tar.gz
http://nginx.org/download/nginx-1.10.3.tar.gz
安裝相關依賴
yum -y install gcc gcc-c++ automake autoconf libtool make glibc glibc-devel lsof
選擇源碼存放目錄
可以是任何目錄,本文選定的是/usr/local/src
cd /usr/local/src
安裝相關依賴庫
安裝PCRE庫在官網ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/下載最新的PCRE源碼包,使用下面命令下載編譯和安裝PCRE包:
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.40.tar.gz?
tar -zxvf pcre-8.40.tar.gz
cd pcre-8.40
./configure
make
make install
安裝zlib庫
在官網http://www.zlib.net/下載最新的zlib源碼包,使用下面命令下載編譯和安裝zlib包:
cd /usr/local/src
?
wget http://zlib.net/zlib-1.2.11.tar.gz
tar -zxvf zlib-1.2.11.tar.gz
cd zlib-1.2.11
./configure
make
make install
安裝openssl庫
在官網https://www.openssl.org/source/下載最新openssl源碼,使用下面的命令下載編譯和安裝openssl包:
cd /usr/local/src
wget https://www.openssl.org/source/openssl-1.1.0e.tar.gz
tar -zxvf openssl-1.1.0e.tar.gz
源碼編譯nginx-1.10.3
cd /usr/local/srcwget http://nginx.org/download/nginx-1.10.3.tar.gz
tar -zxvf nginx-1.10.3.tar.gz
cd nginx-1.10.3
?
./configure --with-http_ssl_module \
--with-pcre=/usr/local/src/pcre-8.40 \
--with-zlib=/usr/local/src/zlib-1.2.11 \
--with-openssl=/usr/local/src/openssl-1.1.0e
?
make
make install
默認安裝路徑在/usr/local/nginx
nginx相關操作
啟動nginx
cd /usr/local/nginx/sbin/
./nginx
快速停止:
cd /usr/local/nginx/sbin
./nginx -s stop
此方式相當于先查出nginx進程id再使用kill命令強制殺掉進程。
優雅停止
./nginx -s quit
此方式停止步驟是待nginx進程處理任務完畢進行停止。
重啟nginx
./nginx -s quit
./nginx
檢查配置文件語法正確性
./nginx -t
重新加載配置文件./nginx -s reload
查看編譯選項和安裝模塊等信息
./nginx -V
測試
nginx安裝成功,啟動nginx,即可訪問虛擬機上的nginx:
ps auxf | grep nginx
netstat -lntp
http://localhost
到這說明nginx上安裝成功。
參考文獻
[1].http://www.nginx.cn/install
[2].
總結
以上是生活随笔為你收集整理的在CentOS 6.8 x86_64上安装nginx 1.10.3的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 在Ubuntu 16.04.1 LTS上
- 下一篇: 实现第一个自定义nginx模块