一,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
七,測試安裝后的效果:
通過瀏覽器訪問: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