nginx OpenResty安裝
- 1. 下載下傳軟體
- 2. nginx-http-concat需要迅雷下載下傳,否者直接下載下傳可能失敗,下載下傳後可scp傳上去
- 3. 解壓軟體
- 4. 下載下傳解壓軟體,用來解壓nginx-http-concat-master.zip
- 5. 将nginx-http-concat-master移動到openresty-1.19.3.1/bundle/ 友善openresty編譯安裝
- 6. 将軟體全部整理到software目錄下
- 7. 建構openresty
-
- 7.1 安裝編譯軟體
- 7.2 安裝perl[看情況]
- 7.3 進入openresty
- 7.4 開始編譯
- 7.5 如下為預設安裝的子產品
- 7.6 将nginx,軟連結到/usr/sbin/nginx
- 8. nginx的基本指令
1. 下載下傳軟體
[[email protected] ~]# pwd
/root
[[email protected] ~]# wget https://openresty.org/download/openresty-1.19.3.1.tar.gz
[[email protected] ~]# wget https://ftp.openssl.org/source/openssl-1.1.1i.tar.gz
[[email protected] ~]# wget https://ftp.pcre.org/pub/pcre/pcre-8.44.tar.gz
[[email protected] ~]# wget https://zlib.net/zlib-1.2.11.tar.gz
2. nginx-http-concat需要迅雷下載下傳,否者直接下載下傳可能失敗,下載下傳後可scp傳上去
[[email protected] ~]# wget https://github.com/alibaba/nginx-http-concat/archive/master.zip
3. 解壓軟體
[[email protected] ~]# tar -xzvf openresty-1.19.3.1.tar.gz
[[email protected] ~]# tar -xzvf openssl-1.1.1i.tar.gz
[[email protected] ~]# tar -xzvf pcre-8.44.tar.gz
[[email protected] ~]# tar -xzvf zlib-1.2.11.tar.gz
4. 下載下傳解壓軟體,用來解壓nginx-http-concat-master.zip
[[email protected] ~]# yum install unzip
[[email protected] ~]# unzip nginx-http-concat-master.zip
5. 将nginx-http-concat-master移動到openresty-1.19.3.1/bundle/ 友善openresty編譯安裝
[[email protected] ~]# mv nginx-http-concat-master/ openresty-1.19.3.1/bundle/
6. 将軟體全部整理到software目錄下
[[email protected] ~]# mkdir software
[[email protected] ~]# mv openresty-1.19.3.1 openssl-1.1.1i pcre-8.44 zlib-1.2.11 software/
7. 建構openresty
7.1 安裝編譯軟體
[[email protected] ~]# yum install -y gcc-c++
7.2 安裝perl[看情況]
[[email protected] ~]# yum install perl
7.3 進入openresty
[[email protected] ~]# cd software/openresty-1.19.3.1/
[[email protected] openresty-1.19.3.1]# pwd
/root/software/openresty-1.19.3.1
7.4 開始編譯
特别說明:–with-http_v2_module為支援http2的子產品
[[email protected] openresty-1.19.3.1]# ./configure --with-http_v2_module --with-openssl=/root/software/openssl-1.1.1i --add-module=/root/software/openresty-1.19.3.1/bundle/nginx-http-concat-master --with-pcre=/root/software/pcre-8.44 --with-zlib=/root/software/zlib-1.2.11 --with-http_stub_status_module --with-http_gzip_static_module
[[email protected] openresty-1.19.3.1]# gmake
[[email protected] openresty-1.19.3.1]# gmake install
7.5 如下為預設安裝的子產品
configure arguments:
--prefix=/usr/local/openresty/nginx
--with-cc-opt=-O2
--add-module=../ngx_devel_kit-0.3.0
--add-module=../echo-nginx-module-0.61
--add-module=../xss-nginx-module-0.06
--add-module=../ngx_coolkit-0.2rc3
--add-module=../set-misc-nginx-module-0.32
--add-module=../form-input-nginx-module-0.12
--add-module=../encrypted-session-nginx-module-0.08
--add-module=../srcache-nginx-module-0.31
--add-module=../ngx_lua-0.10.13
--add-module=../ngx_lua_upstream-0.07
--add-module=../headers-more-nginx-module-0.33
--add-module=../array-var-nginx-module-0.05
--add-module=../memc-nginx-module-0.19
--add-module=../redis2-nginx-module-0.15
--add-module=../redis-nginx-module-0.3.7
--add-module=../rds-json-nginx-module-0.15
--add-module=../rds-csv-nginx-module-0.09
--add-module=../ngx_stream_lua-0.0.5
--with-ld-opt=-Wl,-rpath,/usr/local/openresty/luajit/lib
--with-stream --with-stream_ssl_module
--with-http_ssl_module
7.6 将nginx,軟連結到/usr/sbin/nginx
[[email protected] ~]# ln -s /usr/local/openresty/nginx/sbin/nginx /usr/sbin/nginx
8. nginx的基本指令
# 啟動nginx程序
[[email protected] ~]# nginx
# 關閉nginx程序
[[email protected] ~]# nginx -s stop
# 檢查配置檔案是否有誤
[[email protected] ~]# nginx –t
# 重新加載配置檔案
[[email protected] ~]# nginx –s reload