nginx OpenResty安装

1. 下载软件

[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

2. nginx-http-concat需要迅雷下载,否者直接下载可能失败,下载后可scp传上去

[root@localhost ~]# wget https://github.com/alibaba/nginx-http-concat/archive/master.zip

3. 解压软件

[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

4. 下载解压软件,用来解压nginx-http-concat-master.zip

[root@localhost ~]# yum install unzip
[root@localhost ~]# unzip nginx-http-concat-master.zip

5. 将nginx-http-concat-master移动到openresty-1.19.3.1/bundle/ 方便openresty编译安装

[root@localhost ~]# mv nginx-http-concat-master/ openresty-1.19.3.1/bundle/

6. 将软件全部整理到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/

7. 构建openresty

7.1 安装编译软件

[root@localhost ~]# yum install -y gcc-c++

7.2 安装perl[看情况]

[root@localhost ~]# yum install perl

7.3 进入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

7.4 开始编译

特别说明:–with-http_v2_module为支持http2的模块

[root@localhost 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

[root@localhost openresty-1.19.3.1]# gmake
[root@localhost 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

[root@localhost ~]# ln -s /usr/local/openresty/nginx/sbin/nginx /usr/sbin/nginx

8. nginx的基本命令

# 启动nginx进程
[root@localhost ~]# nginx

# 关闭nginx进程
[root@localhost ~]# nginx -s stop

# 检查配置文件是否有误
[root@localhost ~]# nginx –t

# 重新加载配置文件
[root@localhost ~]# nginx –s reload
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值