1. 安装nginx
# 下载软件
[root@localhost ~]# pwd
/root
[root@localhost ~]# wget https://openresty.org/download/openresty-1.19.3.1.tar.gz
[root@localhost ~]# wget https://ftp.openssl.org/source/openssl-1.1.1i.tar.gz
[root@localhost ~]# wget https://ftp.pcre.org/pub/pcre/pcre-8.44.tar.gz
[root@localhost ~]# wget https://zlib.net/zlib-1.2.11.tar.gz
# nginx-http-concat需要迅雷下载,否者直接下载失败,下载后可scp传上去
[root@localhost ~]# wget https://github.com/alibaba/nginx-http-concat/archive/master.zip
# 解压软件
[root@localhost ~]# tar -xzvf openresty-1.19.3.1.tar.gz
[root@localhost ~]# tar -xzvf openssl-1.1.1i.tar.gz
[root@localhost ~]# tar -xzvf pcre-8.44.tar.gz
[root@localhost ~]# tar -xzvf zlib-1.2.11.tar.gz
# 下载解压软件,用来解压nginx-http-concat-master.zip
[root@localhost ~]# yum install unzip
[root@localhost ~]# unzip nginx-http-concat-master.zip
# 将nginx-http-concat-master移动到openresty-1.19.3.1/bundle/ 方便openresty编译安装
[root@localhost ~]# mv nginx-http-concat-master/ openresty-1.19.3.1/bundle/
# 将软件全部整理到software目录下
[root@localhost ~]# mkdir software
[root@localhost ~]# mv openresty-1.19.3.1 openssl-1.1.1i pcre-8.44 zlib-1.2.11 software/
# 构建openresty
# 安装编译软件
[root@localhost ~]# yum install -y gcc-c++
# 进入openresty
[root@localhost ~]# cd software/openresty-1.19.3.1/
[root@localhost openresty-1.19.3.1]# pwd
/root/software/openresty-1.19.3.1
# 开始编译
[root@localhost openresty-1.19.3.1]# ./configure --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
[root@localhost openresty-1.19.3.1]# gmake
[root@localhost openresty-1.19.3.1]# gmake install
# 如下为默认安装的模块
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
# 将nginx,软链接到/usr/sbin/nginx
[root@localhost ~]# ln -s /usr/local/openresty/nginx/sbin/nginx /usr/sbin/nginx
# 2. nginx的基本命令
# 启动nginx进程
nginx
# 关闭nginx进程
nginx -s stop
# 检查配置文件是否有误
nginx –t
# 重新加载配置文件
nginx –s reload
发表回复