侧边栏壁纸
博主头像
cn2linux博主等级

行动起来,活在当下

  • 累计撰写 127 篇文章
  • 累计创建 1 个标签
  • 累计收到 0 条评论

目 录CONTENT

文章目录

服务部署 编译 Openresty

设置环境变量

export USER=www
export NGINX_VERSION=1.21.4.3
export SSL_VERSION=3.2.0
export CPUS=$(grep 'cores' /proc/cpuinfo |wc -l)

创建服务账号

id ${USER}||useradd ${USER}  -M -s /usr/bin/false

安装依赖

dnf install -y perl pcre pcre-devel gcc zlib-devel geoip-devel gd-devel mlocate readline-devel

下载相关依赖包并解压

curl -L https://www.openssl.org/source/openssl-${SSL_VERSION}.tar.gz | \
tar xz -C /opt
curl -L https://openresty.org/download/openresty-${NGINX_VERSION}.tar.gz |\
tar xz 
cd openresty-${NGINX_VERSION}

编译OPENRESTY

./configure  --prefix=/usr/local/openresty-${NGINX_VERSION} \
--user=www --group=www \
--with-threads \
--with-poll_module \
--with-pcre-jit \
--with-http_ssl_module \
--with-http_v2_module \
--with-http_realip_module \
--with-http_image_filter_module=dynamic \
--with-http_geoip_module=dynamic \
--with-http_sub_module \
--with-http_flv_module \
--with-http_dav_module \
--with-http_mp4_module \
--with-luajit \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_auth_request_module \
--with-http_stub_status_module \
--with-http_random_index_module \
--with-http_iconv_module \
--with-http_secure_link_module \
--with-stream \
--with-stream_ssl_module \
--with-stream_realip_module \
--with-stream_geoip_module=dynamic \
--with-stream_ssl_preread_module \
--with-openssl=/opt/openssl-${SSL_VERSION}
make -j${CPUS} && make install

添加软连接

ln -s /usr/local/openresty-1.21.4.3/ /usr/local/openresty

添加OPENRESTY 环境变量

cat > /etc/profile.d/OPENRESTY-BIN.sh <<EOF
export OPENRESTY_BIN=/usr/local/openresty-1.21.4.3/bin/
export PATH=\${PATH}:\${OPENRESTY_BIN}
EOF

source /etc/profile.d/OPENRESTY-BIN.sh

清除环境变量

unset USER PHP_VERSION CPUS

0
  • ${post.likes!0}

评论区