Skip to content

Openresty installing guide

FijianJacobs edited this page Jan 1, 2020 · 2 revisions

环境依赖安装

  • centos平台

yum install pcre-devel openssl-devel gcc

注意事项: 如果服务器无法访问外网,需要配置yum repo源!

  • macosx平台

brew update

brew install pcre openssl

安装Openresty

方法1: 编译安装

  • openresty官方下载tar包,建议openresty-1.11.2.3版本及以上版本

wget https://openresty.org/download/openresty-1.11.2.3.tar.gz

  • 解压并进入到目录

tar -xzvf openresty-VERSION.tar.gz

cd openresty-VERSION/

  • configuration
  1. macosx平台
./configure --prefix=/usr/local/openresty/ \
--with-cc-opt="-I/usr/local/opt/openssl/include/ -I/usr/local/opt/pcre/include/" \
--with-ld-opt="-L/usr/local/opt/openssl/lib/ -L/usr/local/opt/pcre/lib/" \
--with-luajit \
--without-http_redis2_module \
--with-http_iconv_module \
--with-pcre-jit \
--with-ipv6 \
--with-http_realip_module \
--with-http_ssl_module \
--with-http_stub_status_module \
--with-http_v2_module
  1. centos平台
./configure --prefix=/usr/local/openresty/ \
--with-luajit \
--without-http_redis2_module \
--with-http_iconv_module \
--with-pcre-jit \
--with-ipv6 \
--with-http_realip_module \
--with-http_ssl_module \
--with-http_stub_status_module \
--with-http_v2_module
  • make install

make

make install

  • 设置soft link
ln -s /usr/local/openresty/bin/resty /usr/local/bin/resty
ln -s /usr/local/openresty/bin/openresty /usr/local/bin/openresty
ln -s /usr/local/openresty/nginx/sbin/nginx /usr/local/bin/nginx

方法2: yum安装(centos平台)

  • 配置yum仓库

yum install yum-utils

yum-config-manager --add-repo https://openresty.org/package/rhel/openresty.repo

  • yum安装

yum install openresty

yum install resty

  • 设置soft link

ln -s /usr/local/openresty/bin/resty /usr/local/bin/resty

ln -s /usr/local/openresty/bin/openresty /usr/local/bin/openresty

ln -s /usr/local/openresty/nginx/sbin/nginx /usr/local/bin/nginx

测试安装

nginx -v
resty -v
openresty -v
Clone this wiki locally