centos8上安装openresty
一,openresty的官网地址:
http://openresty.org/
说明:说一下openresty的安装方式:
从openresty的安装目录下,可以看到openresty编译安装了自己作了魔改的几个库: luajit,nginx,openssl,pcre,zlib
[root@localhost openresty]# pwd /usr/local/openresty [root@localhost openresty]# ls bin COPYRIGHT luajit lualib nginx openssl pcre site zlib
如果编译源码方式安装,可能会有一些编译参数与二进制版不一致导致openresty的安装/运行中出现bug,
所以除非openresty内置nginx的编译参数不满足需求,否则强烈推荐采用官方打好的二进制包方式安装,
针对centos平台,当然是使用yum
说明:架构森林是一个专注架构的博客,地址:https://www.cnblogs.com/architectforest
对应的源码可以访问这里获取: https://github.com/liuhongdi/
说明:作者:刘宏缔 邮箱: 371125307@qq.com
二,查看本地centos的版本:
[root@localhost lib]# cat /etc/redhat-release CentOS Linux release 8.1.1911 (Core)
三,安装yum-utils
[root@localhost liuhongdi]# yum install -y yum-utils
四,给yum 添加安装openresty的repo:
[root@localhost liuhongdi]# yum-config-manager --add-repo https://openresty.org/package/rhel/openresty.repo 添加仓库自:https://openresty.org/package/rhel/openresty.repo
说明:为何在这里使用rhel的repo?
因为centos8发布较晚,openresty当前还没有发布centos8的包,
所以我们使用可以通用的rhel的repo
五,安装openresty
[root@localhost liuhongdi]# yum install -y openresty
六,启动openresty
[root@localhost liuhongdi]# systemctl start openresty
七,关闭防火墙
stop firewalld.service && systemctl disable firewalld.service
八,测试安装后的效果:
通过浏览器访问:http://127.0.0.1/
如下图
八,安装openresty的命令行工具 resty:
[root@localhost conf]# yum install -y openresty-resty
九,查看当前安装的openresty的版本:
[root@localhost lib]# /usr/local/openresty/bin/openresty -V nginx version: openresty/1.15.8.2 built by gcc 8.2.1 20180905 (Red Hat 8.2.1-3) (GCC) built with OpenSSL 1.1.0k 28 May 2019 TLS SNI support enabled configure arguments: --prefix=/usr/local/openresty/nginx --with-cc-opt='-O2 -DNGX_LUA_ABORT_AT_PANIC -I/usr/local/openresty/zlib/include -I/usr/local/openresty/pcre/include -I/usr/local/openresty/openssl/include' --add-module=../ngx_devel_kit-0.3.1rc1 --add-module=../echo-nginx-module-0.61 --add-module=../xss-nginx-module-0.06 --add-module=../ngx_coolkit-0.2 --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.15 --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=../ngx_stream_lua-0.0.7 --with-ld-opt='-Wl,-rpath,/usr/local/openresty/luajit/lib -L/usr/local/openresty/zlib/lib -L/usr/local/openresty/pcre/lib -L/usr/local/openresty/openssl/lib -Wl,-rpath,/usr/local/openresty/zlib/lib:/usr/local/openresty/pcre/lib:/usr/local/openresty/openssl/lib' --with-cc='ccache gcc -fdiagnostics-color=always' --with-pcre-jit --with-stream --with-stream_ssl_module --with-stream_ssl_preread_module --with-http_v2_module --without-mail_pop3_module --without-mail_imap_module --without-mail_smtp_module --with-http_stub_status_module --with-http_realip_module --with-http_addition_module --with-http_auth_request_module --with-http_secure_link_module --with-http_random_index_module --with-http_gzip_static_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-threads --with-dtrace-probes --with-stream --with-stream_ssl_preread_module --with-http_ssl_module