安装openresty步骤与安装时问题解决方法
安装OpenResty
安装步骤可上openresty官网有详细安装步骤,OpenResty官方网站.
- 在官网下载源码包,openresty-VERSION.tar.gz
- 解压后需要先安装开发库,使用 apt-get安装以下的开发库
apt-get install libpcre3-dev \
libssl-dev perl make build-essential curl
-
假如安装过程没有依赖包关系,也就是遇到了apt --fix-broken install错误。就可选择执行
apt-get update和apt --fix-broken install
安装依赖包,再执行上面命令。 -
所以安装结束后就可以执行
./configure --prefix=/opt/openresty \
--with-luajit \
--without-http_redis2_module \
--with-http_iconv_module \
--with-http_postgres_module
- 默认, --prefix=/usr/local/openresty 程序会被安装到/usr/local/openresty目录.
- ./configure --help 查看更多的选项。
- 配置文件(./configure script)运行出错可以到 build/nginx-VERSION/objs/autoconf.err 找到。
在进行./configure编译Nginx提示gzip module requires the zlib library
执行sudo apt install zlib1g-dev
可解决
在进行./configure编译Nginx提示ngx_postgres addon was unable to detect version of the libpq library
执行sudo apt-get install libpq-dev
可解决
- 执行完./configure,可执行
make
来编译,假如电脑支持多核 make 工作的特性, 您可以这样编译make -j2
假设机器是双核。 - 如果前面的步骤都没有问题的话,您可以使用下面的命令安装 OpenResty 到您的系统中
make install
使用 sudo 来获取 root 权限来完成安装。