
文章目录1.解压2.安装1.解压压缩包放在/usr/local进入此路径解压tar-zxvfopenresty-1.19.3.1.tar.gz2.安装将解压目录更名并进入mvopenresty-1.19.3.1 openrestycdopenresty编译安装./configuremakemakeinstall编译安装过程中有可能会出错提示error: the HTTP rewrite module requires the PCRE library或者error: the HTTP cache module requires md5 functions from OpenSSL library需安装OpenSSL依赖#如果缺少PCRE或OpenSSL依赖用此命令安装yum-yinstallpcre-devel openssl openssl-devel也可能会出现ERROR: failed to run command: gmake TARGET_STRIP: CCDEBUG-g XCFLAGS‘-DLUAJIT_ENABLE_LUA52COMPAT’ CCcc PREFIX/usr/local/openresty/luajit…这时候需要安装C 编译器#如果缺少C 编译器(cc)用此命令安装yum-yinstallgcc环境变量配置nginx或openresty都行上述两个路径都可以做环境变量路径编辑profilevim/etc/profile末尾加以下配置#nignxexportNGINX_HOME/usr/local/openresty/nginx/exportPATH$PATH:$NGINX_HOME/sbin配置后不要忘了刷新source/etc/profile添加Nginx服务vim/usr/lib/systemd/system/nginx.service内容粘贴进去[Unit]DescriptionnginxAfternetwork.target[Service]TypeforkingExecStart/usr/local/openresty/bin/openresty-c/usr/local/openresty/nginx/conf/nginx.confExecReload/usr/local/openresty/bin/openresty-sreloadExecStop/usr/local/openresty/bin/openresty-squitPrivateTmptrue[Install]WantedBymulti-user.target允许自启动并开启redissystemctlenablenginx systemctl start nginx systemctl status nginx注意服务名设置的是nginx如果是openresty,就是systemctl … openresty