#安装扩展软件
yum install -y wget gcc gcc-c++ make pcre pcre-devel zlib zlib-devel openssl openssl-devel git
#下载openresty
wget https://github.com/openresty/openresty/releases/download/v1.15.8.3/openresty-1.15.8.3.tar.gz
cd openresty-1.15.8.3
./configure
gmake && gmake install

#添加环境变量
tail -n1 /etc/profile
export PATH=/usr/local/openresty/bin:$PATH

source /etc/profile
openresty -V
\nginx version: openresty/1.15.8.3
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) 
built with OpenSSL 1.0.2k-fips  26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/usr/local/openresty/nginx --with-cc-opt=-O2 --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=../rds-json-nginx-module-0.15 --add-module=../rds-csv-nginx-module-0.09 --add-module=../ngx_stream_lua-0.0.7 --with-ld-opt=-Wl,-rpath,/usr/local/openresty/luajit/lib --with-stream --with-stream_ssl_module --with-stream_ssl_preread_module --with-http_ssl_module

#配置systemctl
cat /usr/lib/systemd/system/openresty.service 
[Unit]
Description=openresty
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/openresty/bin/openresty
[Install]
WantedBy=multi-user.target

systemctl daemon-reload && systemctl enable --now openresty
systemctl status openresty
● openresty.service - openresty
   Loaded: loaded (/usr/lib/systemd/system/openresty.service; enabled; vendor preset: disabled)
   Active: active (running) since Tue 2022-07-05 21:23:34 CST; 38s ago
  Process: 14349 ExecStart=/usr/local/openresty/bin/openresty (code=exited, status=0/SUCCESS)
 Main PID: 14350 (openresty)
   CGroup: /system.slice/openresty.service
           ├─14350 nginx: master process /usr/local/openresty/bin/openresty
           └─14351 nginx: worker process

Jul 05 21:23:34 Test22 systemd[1]: Starting openresty...
Jul 05 21:23:34 Test22 systemd[1]: Started openresty.

星霜荏苒 居诸不息