一、安装nginx
安装nginx教程就不具体介绍了,网上教程很多,随便搜几个就ok。
二、安装openresty
推荐安装openresty。openresty是一个打包程序,包含大量的第三方Nginx模块,包括lua。咱们现在主要是使用其中的ngx_lua模块来帮助nginx日志记录response。
1、安装openresty依赖
ubuntu安装:
# sudo apt-get install libreadline-dev libncurses5-dev libpcre3-dev \
libssl-dev perl make build-essential
centos安装:
# yum install readline-devel pcre-devel openssl-devel gcc
2、下载openresty源码:
# wget http://openresty.org/download/openresty-1.9.7.4.tar.gz
3、解压
# tar xf openresty-1.9.7.4.tar.gz
4、编译安装
# cdopenresty-1.9.7.4
# ./configure --prefix=/opt/openresty \
--with-luajit \
--without-http_redis2_module \
--with-http_iconv_module
# make && make install
此方法本次测试暂时不可用,请参考官方安装文档:http://openresty.org/cn/linux-packages.ht