参考:
https://openresty.org/en/installation.html
https://openresty.org/en/installation.html#building-openresty
yum install -y make cmake gcc curl
yum install -y prel pcre-devel
yum install -y openssl openssl-devel
# mkdir -p /opt/software/openresty
# cd /opt/software/openresty/openresty-1.17.8.2/
默认, --prefix=/usr/local/openresty 程序会被安装到/usr/local/openresty目录。
(
编译成功提示:
Type the following commands to build and install:
gmake
gmake install
也可以携带模块参数等安装,如:
# ./configure --prefix=/usr/local/openresty --user=nginx --group=nginx --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_stub_status_module --with-http_gzip_static_module --with-pcre --with-stream --with-stream_ssl_module --with-stream_realip_module
sed -e "s|%%PREFIX%%|/usr/local/openresty/nginx|" \
环境变量:
export PATH=/usr/local/openresty/bin:/usr/local/openresty/nginx/sbin:$PATH
官方建议:
# better also add the following line to your ~/.bashrc or ~/.bash_profile file.
export PATH=/usr/local/openresty/bin:$PATH
cd /usr/local/openresty/nginx/conf
vim nginx.conf
或者直接:vim /usr/local/openresty/nginx/conf/nginx.conf
开放root权限,在文件顶部添加:user root root;
查看版本:
# /usr/local/openresty/bin/openresty -V
nginx version: openresty/1.17.8.2
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
# /usr/local/openresty/bin/openresty
查看启动进程:ps aux |grep openresty
# curl 127.0.0.1
显示:Welcome to OpenResty!
安装成功!
Welcome to OpenResty!
If you see this page, the OpenResty web platform is successfully installed and working. Further configuration is required.